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

Selenium证书解析错误求助:Couldn't read tbsCertificate as SEQUENCE

解决Selenium中Chrome证书解析错误(cert_issuer_source_aia.cc)

问题说明

你遇到的错误是Chrome浏览器在验证证书链时,无法正确解析从AIA(Authority Information Access)获取的DER格式证书,错误日志如下:

Erreur : DevTools listening on ws://127.0.0.1:58097/devtools/browser/e9db2647-35d2-4b97-87fc-5a57f7e3146b
[22280:10456:0312/223717.960: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
[22280:24956:0312/223718.741: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

这类错误不影响表单提交,但会持续输出错误日志,可通过以下方法解决:


解决步骤

1. 启动Chrome时添加证书忽略参数

通过Selenium的ChromeOptions添加参数,强制浏览器跳过证书验证逻辑:

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

chrome_options = Options()
# 忽略证书错误和SSL错误
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--ignore-ssl-errors')
# 若目标是本地服务,添加此参数允许不安全的localhost连接
chrome_options.add_argument('--allow-insecure-localhost')

driver = webdriver.Chrome(options=chrome_options)

2. 使用干净的Chrome用户目录

旧的浏览器缓存或证书存储可能引发解析异常,指定临时空白用户目录规避:

# Windows路径示例
chrome_options.add_argument('--user-data-dir=C:/Temp/ChromeTempProfile')
# Linux/macOS路径示例
# chrome_options.add_argument('--user-data-dir=/tmp/ChromeTempProfile')

3. 匹配ChromeDriver与Chrome浏览器版本

版本不兼容会导致底层证书处理逻辑出错:

  • 查看Chrome版本:设置 → 关于Chrome
  • 下载对应主版本号的ChromeDriver(如Chrome 122.x对应ChromeDriver 122.x)

4. 检查目标网站证书配置(若有权限)

如果是你维护的网站:

  • 确认AIA字段配置正确,指向的证书为合法DER格式
  • 检查证书链完整性,确保中间证书有效

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.28 02:05:15