使用selenium时,出现如下错误:
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
这是因为selenium需要Chromedriver的支持才能打开谷歌浏览器,进行操作。
步骤
1.查看自己谷歌浏览器版本
2.去官网查看当前版本浏览器支持哪个版本的Chromedriver
官网地址:(需要翻墙哦)
https://sites.google.com/a/chromium.org/chromedriver/
3.这里显示我的浏览器支持2.41版本的驱动,于是去驱动地址下载:
地址:
http://chromedriver.storage.googleapis.com/index.html
4.下载好以后,解压,将chromedriver移动到/usr/bin目录下;
5.然后,测试程序正常运行!