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 2,125 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,910 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
Hi,

Still facing the same error message after updating double slashes in a path. Please provide any other solution even though have used the latest chrome driver,ie and firefox drivers.

Kindly, let me know what changes to be made in the script.

Let me know if you wanted to see the program.

Thanks & Regards,

Nainsi

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
8,071 views
+1 vote
1 answer
+1 vote
1 answer

Exception in thread "main" java.lang.IllegalStateException

Your query is similar to the following ...READ MORE

answered Mar 17 in Selenium by Sirajul
• 54,240 points
593 views
0 votes
1 answer

Exception in thread "main" java.lang.IllegalStateException

Your Query is similar to https://www.edureka.co/community/5617 ...READ MORE

answered Apr 13 in Selenium by Sirajul
• 54,240 points
105 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,910 points
1,999 views