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

Undetected ChromeDriver版本匹配仍报错,运行成功率50%求助

解决思路
  • 排查多版本Chrome残留:系统中可能存在旧版Chrome(如130),导致undetected_chromedriver随机调用到不匹配版本。手动指定Chrome可执行文件路径,强制使用131版本:
import undetected_chromedriver as uc
from selenium.webdriver.chrome.options import Options

options = Options()
# 替换为你的Chrome实际安装路径,Mac/Linux路径需对应调整
options.binary_location = "C:/Program Files/Google/Chrome/Application/chrome.exe"
driver = uc.Chrome(options=options)
  • 强制指定ChromeDriver路径:避免库自动下载或调用不匹配的驱动版本,直接指定本地131版本的ChromeDriver路径:
import undetected_chromedriver as uc

# 替换为你的ChromeDriver实际路径
driver = uc.Chrome(driver_executable_path="path/to/your/chromedriver.exe")
  • 清理Chrome临时数据与进程:残留的会话或后台进程可能干扰版本检测。运行脚本前关闭所有Chrome窗口,结束chrome.exe、chromedriver.exe相关进程;也可指定全新临时用户目录启动:
import undetected_chromedriver as uc
from selenium.webdriver.chrome.options import Options

options = Options()
# 创建临时目录避免旧数据干扰
options.add_argument("--user-data-dir=C:/temp/chrome_temp_profile")
driver = uc.Chrome(options=options)
  • 更新undetected_chromedriver:旧版本库可能存在版本检测逻辑bug,执行命令更新到最新版:
pip install --upgrade undetected-chromedriver

内容的提问来源于stack exchange,提问作者The Oracle

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 10:44:52