配置相应的chromedriver

chromedriver下载地址:https://chromedriver.storage.googleapis.com/index.html
Chrome旧版下载地址:http://mydown.yesky.com/pcsoft/416318/versions/
选择谷歌快捷方式的打开文件所在位置
在这里插入图片描述
谷歌版本是73.0.3683.86
chromedriver的2.46版本支持73
在这里插入图片描述
将下载的文件解压
在这里插入图片描述
放置到Python的scripts目录下
在这里插入图片描述
测试语句(打开谷歌浏览器):

from selenium import webdriver
browser=webdriver.Chrome()

报错error:selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH
是需要在browser=webdriver.Chrome()中加入绝对路径
browser = webdriver.Chrome(executable_path = “D:\Python37\Scripts\chromedriver.exe”)

猜你喜欢

转载自blog.csdn.net/qq_39905917/article/details/89070187