My code is very simple code:
WebDriver wd =new ChromeDriver();
System.setProperty("webdriver.chrome.driver",
"D:\\List_of_Jar\\chromedriver.exe");
String baseUrl = "https://www.google.com";wd.get(baseUrl);
have downloaded and added jar as "Java-3.4.0" from selenium hq site. Download Google Chrome Driver-2.29 from the same website and located it in "D:\List_of_Jar" path.
When I run the above code I getting an error as " 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:738)".
Getting version error though did proper configuration. so kindly help me for fixing the issue. Details: OS: Windows XP. Java : JDK1.8 and JRE1.8. Selenium : version 3.4
If you are using IntelliJ IDE, then on IntelliJ without setting up within the 'Run > Edit configurations > VM Options' i will just meet this error:
So once i've added the path to my chromedriver locally in 'Run > Edit configurations > VM Options':
I'm now able to launch my Chrome browser successfully.
I also encountered the same problem. Following fix, made my application run smoothly.
Firstly, the required version of chrome driver could be found from below link.
http://chromedriver.storage.googleapis.com/index.html
It is best to use always the latest version. After downloading, set the path of chrome driver in
System.setProperty("webdriver.chrome.driver","{Your path Chrome Driver}");
Follow the code fragment.
Driver path should be set before browser launch as given below.
I was getting the same error, since chrome driver was not installed on my machine. Install the chrome driver. Follow: https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver
Try:
To avoid Error:
I totally agree with Murthi, but better is to set relative path to the driver, NOT the absolute.
Relative path looks like:
Abosulte: is the path to the driver in your PC.
Why? It is a good practice to have driver inside your project, not just in your computer. Just find or create folder f.e. resources, inside resources create folder called f.e. drivers and import your driver/drivers exe files there.