Chrome 117搭配undetected_chromedriver报错问题求助
解决undetected_chromedriver搭配Chrome 117时的证书错误问题
适配undetected_chromedriver版本到Chrome 117兼容版
先卸载现有版本:pip uninstall undetected-chromedriver -y安装适配Chrome 117的版本,比如3.5.5:
pip install undetected-chromedriver==3.5.5或者直接升级到最新兼容版:
pip install undetected-chromedriver --upgrade配置Chrome忽略证书错误
初始化浏览器时添加证书忽略参数,代码示例:import undetected_chromedriver as uc from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument('--ignore-certificate-errors') chrome_options.add_argument('--ignore-ssl-errors') chrome_options.add_argument('--allow-insecure-localhost') driver = uc.Chrome(options=chrome_options)处理selenium-wire的证书冲突
selenium-wire会注入自有CA证书,可能和Chrome 117安全机制冲突,可尝试:- 禁用selenium-wire的SSL验证(无需抓包时可用),代码示例:
from seleniumwire import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument('--ignore-certificate-errors') seleniumwire_options = { 'verify_ssl': False, } driver = webdriver.Chrome(seleniumwire_options=seleniumwire_options, options=chrome_options)- 手动信任selenium-wire的CA证书:找到
~/.seleniumwire/ca.crt文件,导入Chrome的信任证书列表。
临时降级方案
若上述方法无效,可暂时把Chrome降级到114版本,搭配原来的undetected_chromedriver 3.4.7使用,复刻之前的正常环境。
内容的提问来源于stack exchange,提问作者daiki mamiya
相关产品推荐
相关产品推荐

