python 使用 selenium 时,报错: This version of ChromeDriver only supports Chrome version 85

Posted xiaojin21cen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 使用 selenium 时,报错: This version of ChromeDriver only supports Chrome version 85相关的知识,希望对你有一定的参考价值。

1、问题

python中 使用 selenium 时,常见驱动的报错如下:

报错1:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85

报错2:
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

2、分析:

selenium 对 浏览器操作时,需要相应浏览器的驱动, 或者浏览器驱动的版本不匹配。

3、解决方法

3.1、查看chrome 版本号

版本号是 91.0.4472.106(正式版本) (64 位)

3.2、下载浏览器驱动

浏览器驱动下载地址: http://npm.taobao.org/mirrors/chromedriver

上一步中,chrome 的版本是91.0.4472.106,对应的驱动版本最好一致或接近。

3.3、安装

(1)Chrome 浏览器目录中的安装

在 Chrome 浏览器安装目录中,将下载压缩包中的 chromedriver.exe 拖进来即可。如下图所示:

(2)Python 环境 目录中的安装

在 Python 环境 目录中,将下载压缩包中的 chromedriver.exe 拖进来即可。如下图所示:

以上是关于python 使用 selenium 时,报错: This version of ChromeDriver only supports Chrome version 85的主要内容,如果未能解决你的问题,请参考以下文章