如何快速下载、安装、配置chromedriver

                   如何快速下载、安装、配置chromedriver

1、打开chrome浏览器,选择设置->帮助->关于chrome,查看自己浏览器的版本,如图所示

 

2、对照下图所示的Chrome版本与chromedriver兼容版表,找到适合自己版本的chromedriver

3、打开网站,找到适合自己的版本进行点击 http://npm.taobao.org/mirrors/chromedriver/

 

4、步骤3后,进入到下图所示的界面,根据自己的需求,选择不同系统的版本进行下载

 

5、解压步骤4中下载压缩包,找到chromedriver.exe复制到chrome的安装目录

 

6、可以复制步骤5中chromedriver.exe文件的路径并加入到电脑的环境变量中去,方便以后使用。

 

参考网址:https://jingyan.baidu.com/album/f7ff0bfcdd89ed2e27bb1379.html?picindex=4

 

这样就可以不用setProperty来设置驱动程序的路径

 

7、异常处理:The path to the driver executable must be set by the webdriver.chrome.driver system property;

经实践还是需要setProperty设置谷歌浏览器驱动:System.setProperty("webdriver.chrome.driver","D:\\selenium\\chromedriver.exe")

 

运行程序报错:

参考网址:https://blog.csdn.net/qiyueqinglian/article/details/47419209

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

//chromedriver为谷歌浏览器的驱动程序

System.setProperty("webdriver.chrome.driver","D:\\selenium\\chromedriver.exe")

 

8、运行成功:

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值