Firefox with Marionette, Gecko Driver and Selenium 3.0

History/Context

The Selenium project wants all browser vendors to create and maintain drivers for their own browsers. This kicked Mozilla to work much more quickly on Marionette and geckodriver.

Firefox Versions and Selenium 3.0

  • Firefox 46 was the last release to have the driver built-in;
  • Firefox 47 is not supported for use with Selenium;
  • Firefox 48 (onwards) has a separate driver, gecko driver, which talks to Marionette.

When using FirefoxDriver with Selenium 3.0 this uses Marionette by default (and requires geckodriver).

Usage

Most of my Selenium test automation is done using Java and maven.

Standalone (i.e. Locally)

To run tests using Firefox 48 (onwards) locally, i.e. without a grid, then I would do the following.

Create a new FirefoxDriver() then run the following to download geckodriver (on Linux):

wget https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz
tar -xzf geckodriver-v0.11.1-linux64.tar.gz --directory /tmp

The following would run the tests.

mvn clean test -Dwebdriver.gecko.driver=/tmp/geckodriver

An alternative to specifying the geckodriver location is to simply put the geckodriver on your path or even in the same directory the directory that you run the tests from.

Firefox - Marionette - GeckoDriver - WebDriver

My understanding of the different components/names is as follows:

+----------------------+
|         +----------+ |     +-------------+     +----------------+
| Firefox |Marionette|<----->| geckodriver |<--->| Selenium Tests |
|         +----------+ |     +-------------+     +----------------+
+----------------------+

Hopefully this helps you. If I’ve made a mistake, please get in touch.