慕粉2217209663
2018-10-21 19:41
WebDriver driver ;
System.setProperty("Webdriver.chrom.driver","C:\\Program Files\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
String testUrl="http://www.baidu.com";
driver.get("testUrl");
driver.quit();
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
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:290)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:116)
at commSelenium.Demoselenium1.main(Demoselenium1.java:11)
我也是这样楼主解决了嘛
可能是driver的版本问题,换个别的版本试一下
自动化测试之selenium工具使用
51928 学习 · 192 问题
相似问题