geckodriver.exe not in current directory or path variable, Selenium 2.53.1 + Firefox 48 + Selenium 3 Beta

后端 未结 11 965
心在旅途
心在旅途 2020-12-29 22:43

Seen a lot of questions regarding Selenium 2.53.1 and Firefox 47.0.1, but none in regards to the Selenium 3 Beta release. I am attempting to use the new gecko/marionette Fir

相关标签:
11条回答
  • 2020-12-29 22:56

    If u include the geckodriver.exe in your project and you copy it to your target directory when you compile, the webdriver works as it did in previous versions.

    0 讨论(0)
  • 2020-12-29 22:57

    I kept getting this error also & the only thing I could do to finally fix it (not sure if it's the best answer for everyone who has this issue) was I placed the geckodriver.exe in my main Library directory, then I opened webdriver.py:

    /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py

    found the line where it says: executable_path="geckodriver", firefox_options=None,

    and changed it to:

    executable_path="/Library/geckodriver", firefox_options=None

    0 讨论(0)
  • 2020-12-29 22:59

    If you have the executable in path environment variable, it likely means that it doesn't have permission to access it. As a workaround, try to run Visual Studio as administrator.

    Or you could move it to somewhere that it have permission. Eg:

    var service = FirefoxDriverService.CreateDefaultService(@"D:\tmp\Binaries");
    service.FirefoxBinaryPath = FirefoxBinary;
    
    var options = new FirefoxOptions();
    options.SetPreference("browser.private.browsing.autostart", true);
    
    _driver = new FirefoxDriver(service, options, TimeSpan.FromSeconds(30));
    

    There I put the binaries in D:\tmp\Binaries\ and specified it in the code to check the geckodriver there.

    0 讨论(0)
  • 2020-12-29 23:04

    I was having a Visual Studio 2017 issue where the build would fail because it was looking in a non existent directory for the geckodriver exec. I also had added it using nuget pack manager. What I found was in Visual Studio->Project->Properties->Build it works if you make the build independent of the architecture: Platform target is Any CPU & either leave the other check boxes (Prefer 32-bit, Allow unsafe code, Optimize code) all unchecked or just have Prefer 32-bit checked (which is the default on my system). btw:my Application was a .NET Framework 4.5.2 Console Application

    0 讨论(0)
  • 2020-12-29 23:05

    Try to put the geckodriver.exe in your path: C:\Users\YourName\Documents\Visual Studio 2013\Projects\seleniump\seleniump\bin\Debug

    you can find geckodriver.exe at this link:

    https://github.com/mozilla/geckodriver/releases

    0 讨论(0)
  • 2020-12-29 23:05

    Install the Selenium.Firefox.Webdriver NuGet package.

    This will copy geckodriver.exe to the bin folder.

    0 讨论(0)
提交回复
热议问题