Difference between webdriver.firefox.marionette & webdriver.gecko.driver

Up to version 45 (pushed to version 47), the driver used to automate Firefox was an extension included with each client. But this extension was dropped, probably due to the change of policy which now requires all the extensions to be signed by Mozilla.

Marionette is the new driver that is shipped/included with Firefox.
This driver has it’s own protocol which is not directly compatible with the Selenium/WebDriver protocol.

The Gecko driver (previously named wires) is an application server implementing the Selenium/WebDriver protocol.
It translates the Selenium commands and forwards them to the Marionette driver.

For the Java client, the default behavior is to use the Gecko driver, but it can be overridden to use the legacy extension as a driver with the webdriver.firefox.marionette property:

System.setProperty("webdriver.firefox.marionette", "false");

or with the marionette capability through FirefoxOptions :

FirefoxOptions options = new FirefoxOptions()
  .setLegacy(true);

WebDriver driver = new FirefoxDriver(options);
// or with a remote server
WebDriver driver = new RemoteWebDriver(remoteUrl, options.toDesiredCapabilities());

or directly with the DesiredCapabilities:

DesiredCapabilities capa = DesiredCapabilities.firefox();
capa.setCapability("marionette", false);

WebDriver driver = new FirefoxDriver(capa);
// or with a remote server
WebDriver driver = new RemoteWebDriver(remoteUrl, capa);

And to define the location of the Gecko driver, either place the driver in a folder present in the PATH environment variable, or define the location in the property webdriver.gecko.driver:

System.setProperty("webdriver.gecko.driver", "C:\\geckodriver.exe");

or launch a remote server with the property assigned in the command line:

java -Dwebdriver.gecko.driver="C:\\geckodriver.exe" -jar selenium-server-standalone-3.4.0.jar

Leave a Comment