首页 > 解决方案 > 使用 Chrome v84 时出现“此版本 ChromeDriver 仅支持 Chrome 84 版”

问题描述

我正在尝试使用 Selenium 在 Python 中打开无头 Chrome 浏览器。我正在使用 Chrome v84 并尝试了 Chromedriver v84 和 v83。我在 Mac 上。

import selenium
from selenium import webdriver

path = r"path/to/chromedriver.exe"

op = webdriver.ChromeOptions()
op.add_argument('headless')
driver = webdriver.Chrome(executable_path = path, options=op)

我也试过这个:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

op = webdriver.ChromeOptions()
op.add_argument('headless')
driver = webdriver.Chrome(ChromeDriverManager().install(), options=op)

它返回:

ValueError: There is no such driver by url http://chromedriver.storage.googleapis.com/LATEST_RELEASE_64.0.3282

我还尝试将 Chromedriver 添加到 PATH 并且可以通过 来检查它是否存在echo $PATH,但它不起作用。

在通过自制软件安装 Chromedriver 之后,我也尝试运行brew cask upgrade chromedriver,但它只会安装 Chromedriver v83,并且更新命令只会返回“没有可用更新”之类的内容。

我还尝试通过在终端中/usr/local/bin运行来添加 Chromedriver 的路径。sudo nano /etc/paths不幸的是,这一次运行时并没有出现echo $PATH,正如预期的那样,Python 脚本也没有成功运行。

对此的任何帮助将不胜感激。

标签: pythonmacosseleniumgoogle-chromeselenium-chromedriver

解决方案


您好,您需要根据网络浏览器版本使用确切的驱动程序 exe。转到您的浏览器->关于部分并检查 chrome 的版本,然后您可以在https://chromedriver.chromium.org/downloads这个链接中下载 driver.exe

(浏览器版本会不时更新,因此您需要更新驱动程序版本)


推荐阅读