Unable to resolve error: Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

+1 vote
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:847)

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

at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35)

at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:159)

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

at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)

at edureka.Firstscripts.main(Firstscripts.java:13)
Jun 5, 2019 in Selenium by Haritha

edited Jun 10, 2019 by Abha 1,154 views
Have you set the ChromeDriver path properly before launching the chrome driver? Can you share your code where you have initialized the chrome driver?

1 answer to this question.

+1 vote

Hey Haritha, you can resolve your error by following these steps:

  1. Please download the Chrome driver from here: https://chromedriver.storage.googleapis.com/index.html?path=2.45/
  2. The reason for your error might be because you have to provide the path to chromedriver.exe in your code. Do it using System.setProperty()
  3. In Elipse IDE, path to chromedriver.exe will have to double slashes everywhere and not single slashes which is how usually the path is. Below code is how you should do it:
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Abha_R\\Downloads\\chromedriver_win32.exe");
WebDriver driver = new ChromeDriver();
answered Jun 10, 2019 by Abha
• 27,760 points
I am also facing this issue, How can I solve this issue ? Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; I tried with many versions (downloaded different versions, but not solved yet). Anybody can help me, please. Thank you in Advance

Related Questions In Selenium

0 votes
1 answer
0 votes
0 answers
0 votes
3 answers

java.lang.IllegalStateException Error after adding set property webdriver

/* System.setProperty("WebDriver.gecko.driver", "C:\\Users\\DELL\\Desktop\\GeckoDriver1\\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); */ ...READ MORE

answered May 1, 2019 in Selenium by anonymous
5,413 views
+1 vote
1 answer
+1 vote
0 answers

Exception in thread "main" java.lang.IllegalStateException

package Program; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class ...READ MORE

Jan 16 in Selenium by taruna
• 130 points
109 views
0 votes
1 answer
0 votes
1 answer

getting java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property

Hi Sivaranjani, to resolve your issue, Driver path ...READ MORE

answered Sep 3, 2019 in Selenium by Abha
• 27,760 points
844 views