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.access100ドル
(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
194k44 gold badges304 silver badges385 bronze badges
-
You need to have a web driver for selenium to use. The one mentioned in your error is github.com/mozilla/geckodriver/releasesJoey– Joey2017年04月11日 18:26:55 +00:00Commented Apr 11, 2017 at 18:26
-
Did you read the error, follow the link, and follow the instructions there?JeffC– JeffC2017年04月11日 21:07:22 +00:00Commented Apr 11, 2017 at 21:07
1 Answer 1
To work with Selenium 3.x with Mozila Firefox 52.0.2 you need to:
- Download the latest gecko driver and save it in "C:\your_folder".
- 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");
- Next initialise the Webdriver as:
WebDriver driver = new FirefoxDriver();
- Maximize the browser:
driver.manage().window().maximize();
- Open an url:
driver.get("http:\\gmail.com");
Let me know if this helps you.
answered Apr 11, 2017 at 18:36
Explore related questions
See similar questions with these tags.
lang-java