I am facing the same Exception in thread "main" java.lang.IllegalStateException error. I used System.setProperty() to provide path. Can anyone help me

0 votes
This is the code

package FirstPackage;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class FirstSeleniumProject {

public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "C:\\Users\\KSaraswathiChowdary\\Downloads\\chromedriver_win32.exe");

WebDriver driver = new ChromeDriver();

driver.get("http://way2automation.com");

}

}
Jul 20, 2019 in Selenium by anonymous
328 views

1 answer to this question.

0 votes
Can you please share the screenshot of Error logs in Console. Because your code works fines on my system.
answered Jul 22, 2019 by Abha
• 27,800 points

I am unable to paste the Screenshot here. Below are the error logs in Console

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\KSaraswathiChowdary\Documents\softwares\chromedriver_win32.exe

at com.google.common.base.Preconditions.checkState(Preconditions.java:585)

at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:146)

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

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 FirstPackage.FirstSeleniumProject.main(FirstSeleniumProject.java:13)

I think this error is occurring either because of the wrong chromedriver path or because of the corrupt chromedriver.exe file. Try deleting the chromedriver.exe file and downloading it again. And then copy the path properly and use this path in System.setProperty() method.

Related Questions In Selenium

0 votes
0 answers
0 votes
2 answers

I am trying to run the below code but java.lang.Illegalstate Exception is coming

You are facing this error because while ...READ MORE

answered Jun 21, 2019 in Selenium by Abha
• 27,800 points
145 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
• 27,800 points
1,198 views
+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
• 50,530 points
198 views
0 votes
2 answers

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

You first need to download chrome driver ...READ MORE

answered Aug 26, 2019 in Selenium by Abha
• 27,800 points
483 views