问题
When I try and run the following code I get errors to do with ChromeDriver.
I'm new to this but I can see that the code gets as far as row 11 but then it fails.
Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Matts Learning\ChromeDriver\ChromeDriver 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$000(ChromeDriverService.java:32) 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.(ChromeDriver.java:116) at TestTiscaliLogin.main(TestTiscaliLogin.java:13)
回答1:
Download latest version of Chrome Driver from here -> Under Downloads.
Download the zip file and extract the contents. The contents will have the exe which you need to use. You can also set it by using -
System.setProperty("webdriver.chrome.driver", "C:://you_path_for_exe//chromedriver.exe");
来源:https://stackoverflow.com/questions/39571183/im-getting-erros-when-running-my-java-webdriver-code-its-to-do-with-the-chrom