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();