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

Selenium访问网页遇证书解析错误,寻求技术帮助

解决Selenium访问特定网站时的证书解析错误问题

运行以下Selenium代码访问https://www.sportwetten.de/时:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager


driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.sportwetten.de/")

出现证书解析错误:

[18664:9880:0317/194904.232:ERROR:cert_issuer_source_aia.cc(34)] Error parsing cert retrieved from AIA (as DER):
ERROR: Couldn't read tbsCertificate as SEQUENCE
ERROR: Failed parsing Certificate

可尝试以下几种解决方案:

  • 禁用证书验证:通过ChromeOptions添加参数跳过证书检查,修改后的代码如下:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager

options = Options()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--ignore-ssl-errors')

driver = webdriver.Chrome(options=options, service=Service(ChromeDriverManager().install()))
driver.get("https://www.sportwetten.de/")
  • 匹配ChromeDriver与Chrome版本:确认webdriver-manager安装的ChromeDriver版本和本地Chrome浏览器版本完全一致,若版本不兼容,可手动指定对应版本的ChromeDriver进行安装。

  • 清除浏览器缓存与证书数据:手动打开Chrome浏览器,使用快捷键Ctrl+Shift+Delete清除缓存和Cookie,同时重置浏览器的证书相关设置,之后重新运行脚本。

  • 放宽安全限制参数:额外添加参数降低浏览器安全限制,尝试解决证书解析问题:

options.add_argument('--disable-web-security')
options.add_argument('--allow-running-insecure-content')

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 18:22:48