我是靠谱客的博主 满意仙人掌,这篇文章主要介绍解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in P'chromedriver' executable needs to be in Path,现在分享给大家,希望可以做个参考。
'chromedriver' executable needs to be in Path
声明:本人萌新,刚学python不久记录一下自己的坑,发出来若能帮助到一些人尽早解决问题那便是极好的,( ̄▽ ̄)"
在进行爬虫爬取淘宝商品信息时候,利用selenium来模拟浏览器进行爬取时遇到了这个问题:
selenium.common.exception.WebDriverException:Message:'chromedriver' executable needs to be in Path
详细如下图所示:
这一错误是因为没有配置好chromedriver,怎么配置呢?(我用的是chrome)
1.打开chrome 输入 “chrome://version/”来查看chrome版本 如图我的是63
2.访问此网站 http://chromedriver.storage.googleapis.com/index.html 然后选择合适版本的driver
比如
点击notes.txt就可查看其对应的版本号,如下:
如果符合就可以下载了,下载到自己指定位置然后就可以进行配置了
3. 配置如下:
(具体路径根据自己下载保存的位置而定)
4.这时候运行基本就可以成功了!
不过很不幸,我第一次瞎下的driver版本不对,所以就GG了抛出了如下错误 ConnectionResetError:主机强迫关闭了一个现有连接
于是乎重新下了一个匹配的driver版本然后ok了
最后
以上就是满意仙人掌最近收集整理的关于解决selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in P'chromedriver' executable needs to be in Path的全部内容,更多相关解决selenium.common.exceptions.WebDriverException:内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复