1

I have Selenium version 3.0.1 and Firefox version 46.0.1. In selenium 3.0.1 changelog it is mentioned that:

Geckodriver is now the default mechanism for automating Firefox. This is Mozilla's implementation of a driver for that browser, and is required for automating Firefox versions 48 and above

Although I am getting error:

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

while executing the below code:

@Test
public void test() {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    driver.quit();
}

Why am I getting this error nevertheless I am using Firefox version < 48.0 ? Is it mandatory to use Geckodriver with Selenium 3.0.1 ?

Above code is working perfectly if I make following changes:

System.setProperty("webdriver.gecko.driver","path to geckodriver");
WebDriver driver = new FirefoxDriver();
juherr
  • 5,640
  • 1
  • 21
  • 63
Pratik Patel
  • 2,209
  • 3
  • 23
  • 30

2 Answers2

2

you have to set the following property for all Firefox browsers irrespective of the version from selenium 3.0 onwards :

System.setProperty("webdriver.gecko.driver","path to geckodriver");

Geckodriver is now the default mechanism for automating Firefox. This is Mozilla's implementation of a driver for that browser, and is required for automating Firefox versions 48 and above

Setting the path is compulsory.

If you want to run the tests on Firefox 47 or before, set the Firefox driver capability “marionette” to false.

DesiredCapabilities d = new DesiredCapabilities();
d.setCapability("marionette", false);  // to disable marionette.
WebDriver driver = new FirefoxDriver(d);
Naveen Kumar R B
  • 6,248
  • 5
  • 32
  • 65
0

Changelog link you mentioned is for dotnet. Here is the Changelog for Java

  • Firefox is only fully supported at version 47.0.1 or earlier. Support for later versions of firefox is provided by geckodriver, which is based on the evolving W3C WebDriver spec, and uses the wire protocol in that spec, which is liable to change without notice.
  • You may wish to choose an ESR release such as 45.4.0esr or earlier.
  • Firefox 47.0.0 is not supported at all.
Girish Bellamkonda
  • 491
  • 1
  • 8
  • 17