Selenium and Firefox WebDriver

If you are expecting Firefox WebDriver to work right out the box on a Selenium test it propably will not work. The reason for this is that Firefox recently released its own interpretation of the WebDriver spec – Gecko – supported by their remote protocol Marionette

The key to this is to make sure you are using the most up to date version of Selenium Web Driver. Download the latest version of Gecko and make sure in your Jave test file you point to the executable.

This is how it might look on a Mac install – I used Brew to install:

System.setProperty("webdriver.gecko.driver","/your/install/folder/geckodriver/0.18.0/bin/geckodriver");

I use Maven to handle my dependencies so here you need to make sure you update the Selenium WebDriver dependency:


org.seleniumhq.selenium
selenium-java
3.4.0

On the command line just do: mvn clean install and you should be good to go.

One last tip!
Firefox updates at least once a month and the spec of the Gecko driver may also change. Though not always ideal it might be better in your test environment to prevent automatic updates of Firefox whilst the shake down between Gecko and Selenium continues. Happy testing!