I have this exception since I upgraded to 3.0 beta with Firefox.
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property
setProperty(“propertyName”, “value”)” . It implies that it sets the system property 'propertyName' to have the value 'value'. While testing with Selenium, you will make use of the setProperty method because the browser doesn't have a built-in server to run the automation code.
GeckoDriver is a web browser engine which is used in many applications developed by Mozilla Foundation and the Mozilla Corporation. GeckoDriver is the link between your tests in Selenium and the Firefox browser. GeckoDriver is a proxy for using W3C WebDriver-compatible clients to interact with Gecko-based browsers.
setProperty manages the initialization of the Chrome driver in the first step. The System. setProperty() method forms the basis for test case automation on any browser. Naturally, QAs must understand how to use this fundamental method for all automation purposes in Selenium.
It seems now we need to manually download and set path to the driver executable for Mozilla Firefox also just like chromedriver.
Following is what you need to do:-
Now you need to set system property and write following lines to initialize FireFoxDriver object:-
System.setProperty("webdriver.gecko.driver", "C:\GeckoDriver\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://seleniumhq.com");
Thats it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With