selenium版本不一致导致的报错

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80

出现这个错误一般是webdriver版本和浏览器版本不一致

我的谷歌浏览器版本

 我的webdriver版本

之前装过webdriver,也加入了环境变量中,所以我现在找不到这个变量了,那总不能把我的chrome降到80版本吧

去下载84版本的webdriver

http://chromedriver.storage.googleapis.com/index.html?path=84.0.4147.30/

 当然点击 parent directory可以下载其它版本的驱动

然后解压,放到我的某个文件夹下

 这时我们的代码可以这样写

from selenium import webdriver
if __name__=="__main__":
    webdriver=webdriver.Chrome(executable_path=r'E:\learn\python\webDriver\chromedriver.exe')
    webdriver.get("https://www.baidu.com")
    #webdriver.quit()

使用executable_path指定webdriver路径

如下

如果你觉得上述操作过于繁琐,则可以这样

来源:https://stackoverflow.com/questions/60296873/sessionnotcreatedexception-message-session-not-created-this-version-of-chrome

大概意思是安装驱动管理器,让该管理器自动帮你下载安装驱动

我就不试了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值