java.lang.IllegalStateException: The driver execut

2019-01-29 13:04发布

Guys Please Help Me in The Morning it Was Working Fine Suddenly While i Was Running Test, it asked Me a Popup to Allow Access. Why i Dont Know. First i Cancelled That Pop up after again i Run The Test and Gave Access. From That Time Chrome Driver is Not Opening.

img

Error Stack Trace :

java.lang.IllegalStateException: The driver executable does not exist: E:\Workspace\xxxxxxxxx\‪‪C:\Users\xxxxx\Downloads\chromedriver.exe
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:121)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:116)
at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
at Lead.FinalTest.beforeTest(FinalTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.TestRunner.beforeRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:616)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

3条回答
对你真心纯属浪费
2楼-- · 2019-01-29 13:46

This error message...

java.lang.IllegalStateException: The driver executable does not exist: E:\Workspace\xxxxxxxxx\‪‪C:\Users\xxxxx\Downloads\chromedriver.exe

...implies that the JVM was unable to find the ChromeDriver in the effective location as per the configuration mentioned within your code.

As per your code trial, you have mentioned the location of the ChromeDriver as:

C:\Users\xxxxx\Downloads\chromedriver.exe

But when your testcase gets executed the effective location is considered as:

E:\Workspace\xxxxxxxxx\‪‪C:\Users\xxxxx\Downloads\chromedriver.exe

So, there are some configuration within your code block or IDE configuration or OS PATH variable which modifies the absolute path of the ChromeDriver binary. Addressing this issue will solve your problem.

查看更多
戒情不戒烟
3楼-- · 2019-01-29 13:55

put chrome driver at
C:\Users\xxxxx\Downloads\chromedriver.exe
and set same path in code System.setProperty("webdriver.chrome.driver","C:\Users\xxxxx\Downloads\chromedriver.exe");

查看更多
Melony?
4楼-- · 2019-01-29 14:06

As error says, there is no executable driver exists in the path you have written.

  1. Make sure, that driver still exists in the path.
  2. Try to replace driver(if exists) in another folder and change path in the code
  3. Reinstall driver and set new path in the code

PS: this is not a valid location:

E:\Workspace\xxxxxxxxx\‪‪C:\Users\xxxxx\Downloads\chromedriver.exe
查看更多
登录 后发表回答