0

I use Ubuntu studio 16.10, and I have set up Selenium 3.0.1. I have then installed geckodriver, and used the following

    WebDriver driver = new FirefoxDriver();

    System.setProperty("webdriver.gecko.driver", "/home/myacc/eclipse/jee-neon2/eclipse/geckodriver");

    driver.get("www.google.co.in");

However I still get the following error:

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)

2 Answers 2

0

Initialize the driver instance after setting the system property.

    System.setProperty("webdriver.gecko.driver",  "/home/myacc/eclipse/jee-
    neon2/eclipse/geckodriver");
0

You must download an updated geckodriver. You can't have an old geckodriver and an updated Firefox installed.

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

Download and untar "geckodriver-v0.32.0-linux64.tar.gz" file in the selenium script's folder and run.

Now put this directory in your PATH variable:

export PATH=$PATH:/home/aitor/mygekodriverdirectory

or you can save in /usr/bin, but is dangerous because you'll have to update it frecuently ... easier for me changing the PATH

And lastly run your script:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("www.google.co.in");
1
  • I have written the script in python, but the "short answer" is only that you should update the geckodriver version ! ;)
    – nugbe
    Nov 11, 2022 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .