使用selenium时遇到问题总结

使用selenium.webdriver.Chrome()时报以下错误

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

pip和brew都找不到chromedriver的包,无法下载

只能手动下载解压放在/usr/local/bin目录下

下载地址:http://chromedriver.storage.googleapis.com/index.html

命令行如下

$ unzip chromedriver_map32.zip

$ mv chromedriver /usr/local/bin

$ cd /usr/local/bin

$ chmod a+x chromedirver

执行完上面命令后,启动爬虫,却无法跳入正确页面


报错如下

(Session info: chrome=56.0.2924.87)

(Driver info: chromedriver=2.8.241036,platform=Mac OS X 10.12.0 x86_64)

应该是chrome和chromedriver的版本不兼容问题,我换了2.24的版本后就可以正确跳到所需页面了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容