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

Selenium Wire搭配undetected_chromedriver运行缓慢问题求助

解决Selenium Wire搭配undetected_chromedriver.v2运行过慢的问题

你的问题核心是Selenium Wire默认启用了大量不必要的请求拦截和日志功能,即使你只需要代理转发,这些额外操作也会拖慢运行速度。下面是针对性的优化方案:

  • 禁用请求日志存储:Selenium Wire默认会保存所有请求/响应数据,这是最大的性能开销。通过request_storage=None彻底关闭这一功能,只保留代理转发逻辑。
  • 跳过HTTPS解密验证:如果你不需要查看或修改HTTPS流量,关闭verify_ssl可以省去证书解密和验证的耗时步骤。
  • 精简Chrome启动参数:去掉重复的headless设置,添加几个能提升无头模式性能的参数。
  • 缩短超时时间:避免代理连接时的过长等待,设置合理的超时值。

修改后的完整配置代码:

seleniumwire_options = {
    'proxy': {
        'http': 'http://user:pass@host:port',
        'https': 'https://user:pass@host:port',
    },
    'request_storage': None,  # 关闭请求日志存储
    'verify_ssl': False,      # 跳过HTTPS解密验证
    'connection_timeout': 10, # 代理连接超时(秒)
    'read_timeout': 10        # 响应读取超时(秒)
}

option = ChromeOptions()
option.headless = True
option.add_argument("--disable-gpu")
option.add_argument("--incognito")
# 添加性能优化参数
option.add_argument("--no-sandbox")
option.add_argument("--disable-dev-shm-usage")
option.add_argument("--disable-extensions")
option.add_argument("--disable-plugins")

driver = driverChrome(use_subprocess=True, options=option, seleniumwire_options=seleniumwire_options)

额外说明:如果你的代理需要处理HTTPS加密流量(比如代理本身需要解密),那verify_ssl不要设置为False,此时可以保留disable_encoding=True来避免额外的编码处理。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.22 17:06:26