Solve problems quickly, creatively, and beautifully.

How To Get Your Webdrivers To Work In Selenium 3

The Problem

Selenium 3 was officially released on October 13th of last year. If you've attempted to upgrade to the latest version as I have, you may have noticed that this can break existing automations written for Selenium 2. The fix is quick and easy, and I'll explain briefly the reasons behind the change. 

The Solution

  1. Ensure you have the latest webdrivers from the appropriate vendors installed.
    1. Firefox Marionette/Geckodriver:
    2. Google Chromedriver:
    3. IE Edge:
  2. Update your system's PATH to include the directory of your desired webdriver.
    1. PATH=$PATH:~/myprojects/drivers
  3. Since we don't want to do this manually every time, I recommend adding a line to your .profile, .bash_profile, or .bashrc (Michael Rushanan gives a good explanation of how these work)

The Details

Driver Maintenance

Previously it was necessary for the Selenium team to maintain a set of drivers that interacted with each major browser (Chrome, Firefox, etc). When browsers were updated in the testing environment, in some cases automatically (bad test practice, but that's a topic for another day), tests would break until the browser version was either rolled back, or an updated webdriver was made available. 

We've come a long way since the early days, and browser automation is now so common that the browser teams recognized the need to begin maintaining their own webdrivers in-house, and began bundling them with each new release. Firefox, for example, began using their Marionette/geckodriver for all releases including and after 47 - this means that 46 was the last version supported by the trusty FirefoxDriver. 

Because webdrivers are now out of the hands of Selenium, they can no longer be reasonably certain of their location at runtime. Previously it was standard practice to provide custom paths as part of the call to the webdriver, but the cleanest and simplest method (and the one officially endorsed by Selenium) is to assume the webdriver is in the system's PATH, and make a call to it. This requires, of course, that the directory with the desired webdriver be in the system's PATH, otherwise angels with fiery swords will descend from the heavens astride eight-headed beasts as the ground beneath your feet belches molten fragments of what used to be your automated regression suite. 


Python and Docker: Using Minimalist Distributions

Why I am excited about Python 3.6