Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:120)
Asked
Active
Viewed 5,005 times
-1

Pang
- 9,564
- 146
- 81
- 122

Venkatesh Venky
- 1
- 1
- 2
-
1Possible duplicate of [Driver executable must be set by the webdriver.ie.driver system property](https://stackoverflow.com/questions/10995314/driver-executable-must-be-set-by-the-webdriver-ie-driver-system-property) – Chanda Korat Jun 05 '17 at 12:41
1 Answers
1
Here is the Answer to your Question:
When you work with Selenium 3.x you have to download chromedriver.exe from here and save it in your machine. Next you have to mention the absolute path of the chromedriver.exe through System.setProperty
. While you mention the absolute path of the chromedriver.exe through System.setProperty
you have either provide front slashes "/" or esacpe the back slases "\\". Here is your own working code with some simple tweaks:
public class first
{
public static void main(String args[])
{
System.setProperty("webdriver.chrome.driver","C:/your_directory/chromedriver.exe");
WebDriver dr1= new ChromeDriver(); ;
dr1.get("http://www.google.com/");
}
}
Let me know if this Answers your Question

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