我有一个Python脚本,在那里它会自动安装包含ChromeDriverManager个包的chromedrive.今天,它给了我一个错误:

No such driver version 115.0.5790.110 for linux64

代码行:

driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options)

ChromeDriverManager进入ChromeDriverManager的第url名和第LATEST RELEASE名.我看了最后一次修改的版本,上面写着2023年5月.但SO表示,它最近遇到了一个问题.一周前,我的 playbook 也在起作用.

<Contents>
<Key>LATEST_RELEASE</Key>
<Generation>1685523462105569</Generation>
<MetaGeneration>1</MetaGeneration>
<LastModified>2023-05-31T08:57:42.224Z</LastModified>
<ETag>"368684b889419678b04e4899d53d7ab0"</ETag>
<Size>13</Size>
</Contents>

我看了大约SO个,因为我猜它是与新版本的ChromeDriver发布相关的,它不能很好地工作?

有没有人能向我保证,我做对了,这意味着我需要更改脚本以从Path中删除旧版本的chromedrive?

推荐答案

如果你使用的是Chrome版本115或更高版本,你必须查看Chrome for Testing availability仪表盘,它提供了方便的JSON endpoints来下载特定的ChromeDriver版本.


Selenie管理器

With the availability of Selenium v4.6 and above you don't need to explicitly download ChromeDriver, GeckoDriver or any browser drivers as such using webdriver_manager. You just need to ensure that the desired browser client i.e. , or is installed.

Selenie管理器 is the new tool integrated with that would help to get a working environment to run Selenium out of the box. Beta 1 of Selenie管理器 will configure the browser drivers for Chrome, Firefox, and Edge if they are not present on the PATH.


作为解决方案,您可以简单地执行以下操作:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("start-maximized")
driver = webdriver.Chrome(options=options)
driver.get("https://www.google.com/")

TL;DR

Chrome for Testing: reliable downloads for browser automation

Python相关问答推荐

Pandas滚动分钟,来自其他列的相应值

如果AST请求默认受csref保护,那么在Django中使用@ system_decorator(csref_protect)的目的是什么?

使用Python Cerberus初始化一个循环数据 struct (例如树)(v1.3.5)

在Python中管理多个OpenGVBO和VAO实例

过载功能是否包含Support Int而不是Support Int?

使文本输入中的文本与标签中的文本相同

jit JAX函数中的迭代器

如何计算列表列行之间的公共元素

我在使用fill_between()将最大和最小带应用到我的图表中时遇到问题

将特定列信息移动到当前行下的新行

删除最后一个pip安装的包

需要计算60,000个坐标之间的距离

运行Python脚本时,用作命令行参数的SON文本

如何从具有不同len的列表字典中创建摘要表?

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

OR—Tools CP SAT条件约束

如何在turtle中不使用write()来绘制填充字母(例如OEG)

循环浏览每个客户记录,以获取他们来自的第一个/最后一个渠道

将一个双框爆炸到另一个双框的范围内

如何将返回引用的函数与pybind11绑定?