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 13,425 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
• 28,140 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
I am facing the same error in have given system set property path properly, and have downloaded latest chromdriver which is matching with chrome version. Still facing same error

Hi, @There,

To avoid Error

webdriver.chrome.driver  ( should be in small letters )

have to give correct chromedriver.exe ( correct path )

Import all Selenium jars under class Path

Related Questions In Selenium

0 votes
1 answer

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: how to solve it?

Your query is similar to https://www.edureka.co/community/46570/illegalstateexception-executable-automation-chromedriver Check it ...READ MORE

answered Nov 6, 2020 in Selenium by Sirajul
• 59,230 points
3,308 views
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
19,970 views
+1 vote
1 answer
0 votes
1 answer

Exception in thread "main" java.lang.IllegalStateException

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

answered Mar 17, 2020 in Selenium by Sirajul
• 59,230 points
3,415 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, 2020 in Selenium by Sirajul
• 59,230 points
1,460 views
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
• 28,140 points
15,854 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP