栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python 运行selenium发生异常: session not created: This version of ChromeDriver only supports Chrome versio

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python 运行selenium发生异常: session not created: This version of ChromeDriver only supports Chrome versio

用python + selenium写的自动化代码,原来可运行,今天运行突然报如下的错:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96
Current browser version is 98.0.4758.102 with binary path C:UsersadminAppDataLocalGoogleChromeApplicationchrome.exe
Stacktrace:

原因分析:
     报错的原因是ChromeDriver的版本跟Chrome浏览器的版本不一致了,原来Chrome浏览器设置了自动更新,但是ChromeDriver没更新。

解决:

1、安装目前浏览器版本的ChromeDriver

2、禁止chrome浏览器自动升级(通过禁用更新服务)

具体步骤如下:

1、安装目前浏览器版本对应的ChromeDriver

有两个下载地址:

1)http://chromedriver.storage.googleapis.com/index.html

2)https://npm.taobao.org/mirrors/chromedriver/

如:Chrome浏览器版本是 98.0.4758.102

 

下载对应版本:

 

2、安装和配置

将压缩包中的chromedriver.exe复制到原存放ChromeDriver的路径(其他路径也可用):

 

3、注意:升级chromedriver.exe后,验证执行报错

解决: 禁止Chrome浏览器自动升级(通过禁用更新服务)

Win10操作系统,此电脑-管理-服务和应用程序-服务:

重启电脑后,Chrome浏览器将不再自动升级。 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/755537.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号