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

受企业限制无法升级Chrome至138,如何用Chrome137运行Selenium脚本?

解决Chrome v137环境下运行undetected_chromedriver的问题

方法一:手动指定匹配Chrome 137的ChromeDriver

  1. 下载与本地Chrome版本(137.0.7151.69)完全匹配的ChromeDriver,注意对应你的操作系统(Windows/macOS/Linux)。
  2. 修改代码,指定ChromeDriver的路径和对应主版本:
    from selenium import webdriver
    import undetected_chromedriver as uc
    import time
    from selenium.webdriver.common.by import By
    import urllib
    
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--disable-extensions")
    # 替换为你下载的ChromeDriver实际路径,指定主版本137
    web = uc.Chrome(
        options=chrome_options,
        driver_executable_path="/本地路径/chromedriver.exe",
        version_main=137
    )
    
    web.get('https://www....')
    

方法二:强制undetected_chromedriver适配Chrome 137

如果不想手动下载驱动,可直接通过参数指定版本,让工具自动匹配对应驱动:

from selenium import webdriver
import undetected_chromedriver as uc
import time
from selenium.webdriver.common.by import By
import urllib

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-extensions")
# 仅指定主版本137,工具会自动拉取匹配的ChromeDriver
web = uc.Chrome(
    options=chrome_options,
    version_main=137
)

web.get('https://www....')

关键注意事项

  • 务必保证ChromeDriver与本地Chrome的完整版本号完全对应,否则仍会触发版本不兼容错误。
  • 企业网络受限的情况下,手动下载ChromeDriver的方式更可靠,避免工具自动拉取失败。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.12 20:27:06