1

can anyone help with the these errors or tell me what's causing them I added all the .JAR files that were in the file i downloaded from seleniumHQ.org but im still getting these errors:

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:738)

at   org.openqa.selenium.remote.service.DriverService.findExecutable
(DriverService.java:111)

at   org.openqa.selenium.firefox.GeckoDriverService.access$100
(GeckoDriverService.java:38)

at   org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable
(GeckoDriverService.java:112)

at   org.openqa.selenium.remote.service.DriverService$Builder.build
(DriverService.java:302)

at   org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:233)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:121)
    at seleniumTakeTwo.testTutorialTwo.main(testTutorialTwo.java:11)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • You need to have a web driver for selenium to use. The one mentioned in your error is https://github.com/mozilla/geckodriver/releases – Joseph Evans Apr 11 '17 at 18:26
  • Did you read the error, follow the link, and follow the instructions there? – JeffC Apr 11 '17 at 21:07

1 Answers1

1

To work with Selenium 3.x with Mozila Firefox 52.0.2 you need to:

  1. Download the latest gecko driver and save it in "C:\your_folder".
  2. Set the System property mentioning the gecko driver along with its absolute path on your system as:

System.setProperty("webdriver.gecko.driver", "C:\\your_folder\\geckodriver.exe");

  1. Next initialise the Webdriver as:

WebDriver driver = new FirefoxDriver();

  1. Maximize the browser:

driver.manage().window().maximize();

  1. Open an url:

driver.get("http:\\gmail.com");

Let me know if this helps you.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352