Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load webdriver firefox #2577

Closed
Bandatej opened this issue Aug 4, 2016 · 5 comments
Closed

Unable to load webdriver firefox #2577

Bandatej opened this issue Aug 4, 2016 · 5 comments

Comments

@Bandatej
Copy link

Bandatej commented Aug 4, 2016

Meta -

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.(FirefoxDriver.java:220)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:215)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:124)
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:

Expected Behavior -

Actual Behavior -

Steps to reproduce -

@lukeis
Copy link
Member

lukeis commented Aug 4, 2016

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.

@lukeis lukeis closed this as completed Aug 4, 2016
@Hitman007
Copy link

Simply repeating the question as an answer doesn't help at all.

@ThomasLandauer
Copy link

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%

@Raoin
Copy link

Raoin commented Apr 26, 2017

I am having the same issue , where should i copy the .exe file?
capture

@kwa
Copy link

kwa commented Jun 1, 2017

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.

  1. The file name is wrong somehow
  2. The PATH does not contain the correct information

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.

@lock lock bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants