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

0
0

I am now learning selenium and have met a problem.

I am aware that Selenium supported old Firefox version by default without driver. And for recent versions of Firefox, we have to download driver and define it using System.setProperty.

According to this link, for Firefox 45 and 46, start driver code could look like this:

WebDriver driver = new FirefoxDriver();

My Firefox is version 45.5.1., but above code still won’t work. So according to this link, I have added

System.setProperty("webdriver.firefox.marionette","C:\\geckodriver.exe");

And it worked.

Then I realized that I haven’t installed geckodriver.exe on my computer. To see how it goes, I have changed to code below.

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

It still works.

So, here comes my first problem: What happened? I am sure that no geckodriver.exe exists on my environment. If no location has been pointed, then why should I have to set property?

Also, I have seen code like

System.setProperty("webdriver.gecko.driver", "/tools/marionette/wires.exe");

My second question is that what is the difference between webdriver.gecko.driver and webdriver.firefox.marionette or wires.exeand geckodriver.exe?

  • You must to post comments
0
0

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
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website