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
614 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,930 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
0 answers

Getting Java Null Pointer Exception on running the test case in Seleniumn.Can someone pls let me know where i need to fix in order to progress

Below is the Error: java.lang.RuntimeException: java.lang.NullPointerException at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:49) at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:131) at ...READ MORE

Sep 11 in Selenium by sandhya
• 180 points
239 views
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,930 points
258 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,930 points
2,668 views
0 votes
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
• 58,130 points
936 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
• 58,130 points
192 views