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

Selenium Chrome Driver无法识别证书,手动浏览正常求助

Selenium Chrome Driver证书识别问题解决

你的问题核心在于seleniumwire会创建自身代理拦截请求,单纯给Chrome添加--ignore-certificate-errors参数无法绕过seleniumwire层面的SSL证书验证,这就是手动打开Chrome正常,但用seleniumwire驱动时出现证书错误的原因。

解决方法如下:

  • 在初始化webdriver时,添加seleniumwire专属配置,关闭SSL验证:
    from seleniumwire import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    
    chromeOptions = webdriver.ChromeOptions()
    chromeOptions.add_argument('--ignore-certificate-errors')
    
    # 添加seleniumwire配置,关闭SSL验证
    seleniumwire_options = {
        'verify_ssl': False
    }
    
    driver = webdriver.Chrome(
        executable_path=ChromeDriverManager().install(),
        options=chromeOptions,  # 新版Selenium推荐用options替代chrome_options
        seleniumwire_options=seleniumwire_options
    )
    driver.get("https://www.google.com")
    

补充说明:

  1. 若需长期稳定使用,也可将seleniumwire生成的CA证书导入Chrome信任列表,但关闭SSL验证是更快捷的临时解决方案。
  2. chrome_options在新版Selenium中已标记为过时,建议使用options参数替代。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 03:30:21