启动谷歌浏览器报错

来源:6-1 常见浏览器的启动

慕粉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)


写回答 关注

2回答

  • 满分爱意
    2019-02-24 16:42:57

    我也是这样楼主解决了嘛

  • qq_易水寒_27
    2018-12-02 22:19:33

    可能是driver的版本问题,换个别的版本试一下

自动化测试之selenium工具使用

web自动化测试selenium从0基础开始。

51929 学习 · 192 问题

查看课程

相似问题