我收到以下错误:selenium.common.exceptions.SessionNotCreatedException:消息:未创建会话:此版本的ChromeDriver仅支持Chrome114版 当前浏览器版本为116.0.5845.97,二进制路径为C:\Program Files\Google\Chrome\Application\chrome.exe

有谁可以帮我?我在其他帖子中看到了一些建议,但没有一个在这里奏效.我知道SelSelum v4.6的更新

我的代码是:

from selenium import webdriver
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By




class ChromeAuto:
    def __init__(self):
        self.options = webdriver.ChromeOptions()
        self.options.add_experimental_option('excludeSwitches', ['enable-logging'])
        self.service = Service()
        self.chrome = webdriver.Chrome(service=self.service, options=self.options)
        self.chrome.implicitly_wait(20)

推荐答案

对于Chrome 116+,您至少需要selenium 4.11.2才能让Selify Manager从https://googlechromelabs.github.io/chrome-for-testing/下载chromedriver 116+

然后,您将能够运行基本的Selify脚本,如下所示:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service()
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])

driver = webdriver.Chrome(service=service, options=options)
# Add your code here
driver.quit()

Python相关问答推荐

带有pandas的分区列上的过滤器的多个条件read_parquet

Python中的Pool.starmap异常处理

在Transformer中使用LabelEncoding的ML模型管道

如何将带有逗号分隔的数字的字符串解析为int Array?

在上下文管理器中更改异常类型

如何使用stride_tricks.as_strided逆转NumPy数组

如何使用Jinja语法在HTML中重定向期间传递变量?

Pandas 都是(),但有一个门槛

无法通过python-jira访问jira工作日志(log)中的 comments

C#使用程序从Python中执行Exec文件

Python+线程\TrocessPoolExecutor

在Django admin中自动完成相关字段筛选

Pandas Loc Select 到NaN和值列表

有没有一种ONE—LINER的方法给一个框架的每一行一个由整数和字符串组成的唯一id?

当点击tkinter菜单而不是菜单选项时,如何执行命令?

pysnmp—lextudio使用next()和getCmd()生成器导致TypeError:tuple对象不是迭代器''

在二维NumPy数组中,如何 Select 内部数组的第一个和第二个元素?这可以通过索引来实现吗?

Python日志(log)模块如何在将消息发送到父日志(log)记录器之前向消息添加类实例变量

无法在Spyder上的Pandas中将本地CSV转换为数据帧

为什么t sns.barplot图例不显示所有值?'