OS:
Selenium Version: 3.0
Browser: firefox 45
i am getting error as below
Exception in thread "main" 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
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:38)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:91)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:245)
at org.openqa.selenium.firefox.FirefoxDriver.
at org.openqa.selenium.firefox.FirefoxDriver.
at org.openqa.selenium.firefox.FirefoxDriver.
at org.openqa.selenium.firefox.FirefoxDriver.
at Servicenow.LoginwithSSO.main(LoginwithSSO.java:13)
-- Internet Explorer? Firefox?
FIREFOX 48+ IS ONLY COMPATIBLE WITH GECKODRIVER. Any issue logged here for 48+ will be closed as a duplicate of #2559
If the issue is with Google Chrome consider logging an issue with chromedriver instead:
https://sites.google.com/a/chromium.org/chromedriver/help
If the issue is with Microsoft Edge consider logging an issue with Microsoft instead:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/
If the issue is with Firefox GeckoDriver (aka Marionette) consider logging an issue with Mozilla:
https://bugzilla.mozilla.org/buglist.cgi?product=Testing&component=Marionette
If the issue is with PhantomJS consider logging an issue with Ghostdriver:
https://github.com/detro/ghostdriver
-->
Browser Version:
as the message states:
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
If you don't want to use GeckoDriver / marionette. In 3.0 you must specify "marionette": false in the desired capabilities.
Simply repeating the question as an answer doesn't help at all.
In my case, the solution was to copy geckodriver.exe (downloaded from the github-URL above) in the same directory where selenium-server-standalone-3.3.0.jar is located.
This is (somewhat cryptically) "explained" here:
http://www.seleniumhq.org/docs/03_webdriver.jsp#running-standalone-selenium-server-for-use-with-remotedrivers
Unpack [...] chromedriver and put them in a directory which is on the $PATH / %PATH%
I am having the same issue , where should i copy the .exe file?
I had a similar problem and given the solution below I believe it is a problem of integration between webdriver-manager and geckodriver code.
When running a grunt task which runs a protractor test, eventually some (forked) process wants to run the geckodriver. This process tries to locate a file called geckodriver by using the PATH environment. It reads the PATH environment variable and constructs absolute paths by taking each path defined in PATH and adds the file name geckodriver (with and without different extensions like .exe) to find the actual executable. When it finds a constructed path that exists, all is good.
If not, then the error message The path to the driver executable must be set by the webdriver.gecko.driver system property;* ... is displayed.
From this we can deduce that there are two potential problems.
My solution tries to address both problems by running a script which fixes (1) and a grunt configuration which fixes (2).
Note this has been tested for:
node v6.10.3, npm 3.10.10, selenium driver 3.4.0, gecko driver (firefox) v0.16.1, for running against firefox version 53.0.3. During testing I noted that if one of these version is something else than what is indicated it did not work.
Grunt packages used: "grunt-protractor-runner": "~5.0.0", "grunt-protractor-webdriver": "0.2.5"
To fix (1):
My package.json has a section like
"scripts": {
"install": "node node_modules/protractor/bin/webdriver-manager clean && node node_modules/protractor/bin/webdriver-manager update && bash fix-firefox-web-driver.sh"
}
That is, first I ask webdriver-manager to delete every driver, then download fresh drivers and finally run
fix-firefox-web-driver.sh.
The fix-firefox-web-driver.sh "knows" that webdriver-manager will download drivers and unpack them (if you look at the logs when running webdriver-manager update you can see the downloading and unpacking. So the script locates the geckodriver which is actually called something like geckodriver-v0.16.1 and renames/copies it to geckodriver in the same folder.
Now we have solved problem (1).
To fix (2):
When running grunt we need to append the folder where our new geckodriver resides to PATH.
The npm package "grunt-env": "~0.4.4" can concatenate paths to the PATH environment variable when running the grunt task. Here is the configuration:
env: {
testFirefox: {
concat: {
PATH: {
'value': './node_modules/protractor/node_modules/webdriver-manager/selenium/'
}
}
}
}
Given that the protractor tests are run using
grunt.registerTask('gui-tests', [
'env:testFirefox',
'protractor:test'
]);
which means that the PATH will have access to ./node_modules/protractor/node_modules/webdriver-manager/selenium/ where our geckodriver resides.
After this, the protractor tests could run.
Most helpful comment
Simply repeating the question as an answer doesn't help at all.