admin管理员组

文章数量:1665194

chrome的版本和Selenium支持的版本不一致,报错如下:

seleniummon.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 86
Current browser version is 92.0.4515.131 with binary path C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe

解决方法:

1.查询Chrome的版本

报错里面其实也有说明版本是92.0.4515.131。如果报错没有说明Chrome版本,可以在Chrome浏览器地址栏输入chrome://version/

2.下载对应的Chrome版本driver

http://chromedriver.storage.googleapis/index.html

我是在windows环境下的,选择对应的下载资源。

3.解压后放入Chrome安装路径下

4.配置PATH或者使用的时候加上ChromeDriver的路径

(1)方法一:配置PATH


使用的时候直接用,不用加ChromeDriver的路径。

import selenium
from selenium import webdriver
brower = webdriver.Chrome()
brower.get("https://www.baidu/")

(2)方法二:使用的时候加上ChromeDriver的路径

这种方法不用配置环境变量,要加上ChromeDriver的路径。

import selenium
from selenium import webdriver
path =r"C:\Users\Administrator\XXX\Google\Chrome\Application\chromedriver.exe"
brower = webdriver.Chrome(executable_path=path)
brower.get("https://www.baidu/")

本文标签: 版本chromeselenium