chromedriver的版本一定要与Chrome的版本一致,不然就不起作用。
- 查看电脑安装的谷歌浏览器版本
在浏览器中输入chrome://version/
建议关闭谷歌自动更新,防止后续版本不对应,具体参考
https://jingyan.baidu.com/article/b87fe19e8876e91318356893.html
下载对应版本chromedriver
1、http://chromedriver.storage.googleapis.com/index.html
进入文件夹后,如是win32/64系统则选择如下
解压压缩包,找到chromedriver.exe复制到chrome的安装目录(我的在默认安装路径下C:\Program Files (x86)\Google\Chrome\Application )
复制chromedriver.exe文件的路径并加入到电脑的环境变量中去。
操作步骤:我的电脑-右击-属性-高级系统设置-环境变量-Path-编辑-输入chromedriver所在位置 如 C:\Program Files (x86)\Google\Chrome\Application-点击确定按钮