You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ChromeDriver与Chrome版本不兼容求助:如何用Chrome测试版124运行代码

解决ChromeDriver与Chrome测试版124的版本匹配问题

你遇到的错误核心是版本不匹配:ChromeDriver 124仅支持Chrome 124版本,但当前系统默认调用的是123稳定版。要使用Chrome测试版124运行程序,按以下步骤操作:

1. 安装Chrome测试版124

  • 获取Chrome测试版安装包并完成安装,测试版会被安装到独立目录(默认路径通常为C:\Program Files\Google\Chrome Beta\Application\chrome.exe)
  • 安装后打开Chrome测试版,在设置 > 关于Chrome中确认版本为124.x.x.x

2. 修改代码指定Chrome测试版路径

在原代码中添加options配置,明确指定测试版Chrome的二进制文件路径,让Selenium调用测试版而非默认的稳定版:

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

driver_path = r"C:\Users\hp\Desktop\Udemy\chromedriver.exe"  # 保留你的ChromeDriver路径
chrome_beta_path = r"C:\Program Files\Google\Chrome Beta\Application\chrome.exe"

# 配置Chrome选项,指定测试版浏览器路径
options = Options()
options.binary_location = chrome_beta_path

# 初始化驱动服务与浏览器实例
service = Service(executable_path=driver_path)
driver = webdriver.Chrome(service=service, options=options)
driver.get("https://www.google.com")

运行修改后的代码,Selenium会启动Chrome测试版124,与你的ChromeDriver 124版本匹配,即可正常执行。

内容的提问来源于stack exchange,提问作者AFREEN POLY

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 13:17:11