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 in Selenium by anonymous
131 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 by Abha
• 25,740 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
2 answers
0 votes
1 answer
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 in Selenium by Abha
• 25,740 points
290 views
+1 vote
1 answer