当前位置: 移动技术网 > IT编程>脚本编程>Python > Python3 + selenium + Chrome浏览器(webdriver.Chrome()报错)

Python3 + selenium + Chrome浏览器(webdriver.Chrome()报错)

2019年07月30日  | 移动技术网IT编程  | 我要评论

fixrecovery421,2011年贷款利率表,凤凰卫视参数


python3 + selenium + chrome浏览器

error:
  selenium.common.exceptions.webdriverexception: message: 'chromedriver' executable needs to be in path.please see https://sites.google.com/a/chromium.org/chromedriver/home

这是因为调用 webdriver.chrome() 需要设置参数 executable_path,而executable_path 为chromedriver.exe所在地址。

chromedriver.exe的下载地址为 http://chromedriver.storage.googleapis.com/

首先需要确定本机的chrome浏览器的版本,在chrome浏览器里输入"chrome://version"即可,如下图,google chrome冒号后面即为对应版本。本机的chrome版本为75.0.3770.142,下载地址中并无完全吻合的版本,最后下载了75.0.3770.142版本对应的亦可兼容本机。

这是下载地址界面:

然后我们转到对应版本界面,选择对应系统的zip文件下载并解压。

得到chromedriver.exe文件后,给 webdriver.chrome() 添加参数 executable_path = 'path/chromedriver.exe'(path为chromedriver.exe所在的目录)

之后我的代码就运行成功了

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网