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

GeckoDriver NOT found on path by Selenium even though it is on the path #2672

Closed
arosszay opened this issue Aug 26, 2016 · 7 comments
Closed

Comments

@arosszay
Copy link

Meta -

OS: Windows 10

Selenium Version: 3.0.0b2 (python bindings)

Selenium Standalone Server Version: selenium-server-standalone-3.0.0-beta2.jar

Python Version: 3.5.1

Browser: Ha, I feel like I've installed them all, not sure what else I can do. Here's the list that I installed and the order in which I installed:

  • Firefox
  • Firefox Dev Edition
  • Firefox Beta

Browser Version:
Firefox = After installing Firefox Beta, the version number of this browser is no longer available (not sure why this browser disappeared). The version that was present immediately prior to the Firefox Beta install = 46.0.1

Firefox Beta = 49.0b6

Firefox Dev Edition = 50.0a2 (2016-08-24)

Expected Behavior -

After hitting run or debug in my Automation project in my PyCharm IDE, my tests should run successfully as they did prior to upgrading Selenium to use capabilities['marionette'] = True.

Firefox should launch, the tests should run, and after the suite is finished, Firefox should close down.

Actual Behavior -

The following error occurs:

selenium.common.exceptions.WebDriverException: Message: 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

Steps to reproduce -

I have the following line added to my system path (I did this through the "Environment Variable..." menu from the Windows 10 System Properties menu, which is accessed through Control Panel):

C:\Users\My_User\Downloads\Installs\geckodriver-v0.9.0-win64\wires.exe

Additionally, you can see that in my code below, I have the following line, which, to my novice understanding, should programmatically add the geckodriver to the path (am I wrong about this?):

os.environ["webdriver.gecko.driver"] = "C:\\Users\My_User\Downloads\Installs\geckodriver-v0.9.0-win64\wires.exe"

I tried to run my tests, with the following combinations with no luck:

  • just the path being added manually via Control Panel
  • just the path being added programmatically via my Automation framework
  • the path being added both ways, manually as well as programmatically, at the same time

I read that I needed to rename the file to "wires.exe", so am assuming that is still the case. I am confused as to what I'm doing wrong. If nothing, I may have found a legitimate bug. What do you think?

Here's my code that launches the browser:

    import os
    from selenium.webdriver.remote.webdriver import WebDriver
    from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

    class Browser(metaclass=Singleton):
        """Encapsulates Selenium functionality regarding the web browser itself. Launching, Quiting, etc."""
        def __init__(self):
            self.driver = Browser.create_browser(self)

        def create_browser(self):
            """Creates and returns a web browser 'driver' object.

            This method launches a browser and creates the connections to remotely control it using Selenium.
            """
            os.environ["webdriver.gecko.driver"] = "C:\\Users\My_User\Downloads\Installs\geckodriver-v0.9.0-win64\wires.exe"

            capabilities = DesiredCapabilities.FIREFOX.copy()
            capabilities['platform'] = "WIN10"
            capabilities['marionette'] = True
            capabilities['binary'] = "C:\Program Files (x86)\Firefox Developer Edition\\firefox.exe"

            ff_profile_dir = "C:\\Users\My_User\PycharmProjects\Automation\FirefoxProfile"
            ff_profile = FirefoxProfile(profile_directory=ff_profile_dir)

            driver = WebDriver(command_executor='http://127.0.0.1:4444/wd/hub',
                               desired_capabilities=capabilities,
                               browser_profile=ff_profile)

            driver.implicitly_wait(30)
            return driver
@AutomatedTester
Copy link
Member

We don't look at that environment variable. Details on how to use Marionette can be found at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

@cgoldberg
Copy link
Contributor

cgoldberg commented Aug 26, 2016

I may have found a legitimate bug. What do you think?

I think you should read up on how to use the PATH variable.

I have the following line added to my system path:
C:\Users\My_User\Downloads\Installs\geckodriver-v0.9.0-win64\wires.exe

the PATH environment variable contains a list of directories to scan. You have added a path containing a filename, not a directory.

os.environ["webdriver.gecko.driver"] = "C:\Users\My_User\Downloads\Installs\geckodriver-v0.9.0-win64\wires.exe"

The line above doesn't even touch the PATH... you are setting a completely different environment variable.

you want to add to your path with something like:
export PATH=$PATH:/path/to/directory/of/executable/

@nirvdrum
Copy link
Contributor

export doesn't work on Windows. You can use set, but you may be better off just doing it through the GUI.

@arosszay
Copy link
Author

@cgoldberg , thank you for telling me that information. I was unaware of that! I made the changes, however, I'm still getting the same error as before.

I now have the following line in my path, system variable (added through the Windows GUI)

C:\Users\My_User\Downloads\Installs\geckodriver-v0.10.0-win64

I kept my path, user variable the way it was and didn't add anything there.

*I upgraded to use the latest version of geckodriver, since writing the bug last week.

The file that is located in the directory I added to the path has been renamed = "wires.exe"

I've tried running the tests with having the file named "wires.exe" and "geckodriver.exe" with no luck either way.

The way I see things now, I have fixed my path issues, but still getting the same error. Have we got to the official "I found a real bug" phase yet?

Here's what my code looks like now (I have removed the os.environ[] line):

    from selenium.webdriver.remote.webdriver import WebDriver
    from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

    class Browser(metaclass=Singleton):
        """Encapsulates Selenium functionality regarding the web browser itself. Launching, Quiting, etc."""
        def __init__(self):
            self.driver = Browser.create_browser(self)

        def create_browser(self):
            """Creates and returns a web browser 'driver' object.

            This method launches a browser and creates the connections to remotely control it using Selenium.
            """

            capabilities = DesiredCapabilities.FIREFOX.copy()
            capabilities['platform'] = "WIN10"
            capabilities['marionette'] = True
            capabilities['binary'] = "C:\Program Files (x86)\Firefox Developer Edition"

            ff_profile_dir = "C:\\Users\My_User\PycharmProjects\Automation\FirefoxProfile"
            ff_profile = FirefoxProfile(profile_directory=ff_profile_dir)

            driver = WebDriver(command_executor='http://127.0.0.1:4444/wd/hub',
                               desired_capabilities=capabilities,
                               browser_profile=ff_profile)

            driver.implicitly_wait(30)
            return driver

@arosszay
Copy link
Author

arosszay commented Aug 30, 2016

Guys, nevermind! I figured it out!!

PyCharm, the IDE I'm using, for some reason needed to be restarted in order to pick up the changes being made in the path, system variable. It works great now.

Thank you for all the help!!!

@VnishaS
Copy link

VnishaS commented Oct 3, 2016

Hi,
I'm trying to run Selenium program on Firefox.Downloaded gecko driver as mentioned.
However, exe is not getting downloaded from the mentioned path
https://github.com/mozilla/geckodriver/releases

Kindly suggest.

@ddavison
Copy link
Member

ddavison commented Oct 3, 2016

@VnishaS, this issue has been closed. please bring your issue up with the selenium-users-group unless you've found an actual bug with the software. thanks!

@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Oct 3, 2016
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