Search code examples
rubyfirefoxselenium-webdriverrubyminegeckodriver

Selenium webdriver 3.3.0 geckodriver error for firefox


I'm trying to execute a ruby script on my Windows 10.

Setup Details:

Browser :- latest version of Firefox, <br>
ruby -v 2.2.6<br>
gem -v 2.4.5.2 <br>
selenium webdriver -v 3.3.0

Now i got an error that it cant find geckodriver. I also downloaded geckodriver and added it to the Path.

This is the error message that I get:

Selenium::WebDriver::Error::WebDriverError: Unable to find Mozilla geckodriver. Please download the server from https://github.com/mozilla/geckodriver/releases and place it somewhere on your PATH. More info at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver.

How can i solve this problem?


Solution

  • It is clear from the error message which is Unable to find Mozilla geckodriver and place it somewhere on your PATH

    Here is what you need to do:

    1. Download the latest stable gecko driver & place it in a folder in "C:\abc".

    2. Rename the gecko driver to geckodriver.exe

    3. Download and install the latest released Mozila Firefox.

    4. Ensure you are using either 32 bit or 64 bit for both.

    5. Keep your code like:

      System.setProperty("webdriver.gecko.driver", "C:\\abc\\geckodriver.exe");
      WebDriver driver = new FirefoxDriver();
      driver.manage().window().maximize();
      driver.get("http://gmail.com");
      

    Let me know if it works for you.