java+selenium+chrome使用

上一篇 / 下一篇  2017-07-31 22:27:06 / 个人分类:selenium自动化测试

java+selenium调用chrome时报错:
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,
解决方法:
1.下载chromedriver,下载地址如下:
2.把下载的rar包解压缩,把chromedriver.exe放在chrome的安装目录
3.在环境变量中的系统变量的path中设置chrome.exe的环境变量,
4.执行代码
System.setProperty("webdriver.chrome.driver", "C:/Users/youyoucao/AppData/Local/Google/Chrome/Application/chromedriver.exe");
  driver = new chromedriver();
chromedriver版本支持的Chrome版本
v2.31v58-60
v2.30v58-60
v2.29v56-58
v2.28v55-57
v2.27v54-56
v2.26v53-55
v2.25v53-55
v2.24v52-54
v2.23v51-53
v2.22v49-52
v2.21v46-50
v2.20v43-48
v2.19v43-47
v2.18v43-46
v2.17v42-43
v2.13v42-45
v2.15v40-43
v2.14v39-42
v2.13v38-41
v2.12v36-40
v2.11v36-40
v2.10v33-36
v2.9v31-34
v2.8v30-33
v2.7v30-33
v2.6v29-32
v2.5v29-32
v2.4v29-32

TAG:

 

评分:0

我来说两句

Open Toolbar