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

Selenium下93.0.4577.1500版chromedriver的safebrowsing配置报错问题

问题根因

Chrome 93.0.4577版本开始,对安全浏览相关的用户偏好配置规则做了不兼容更新,旧版本支持的"safebrowsing"字符串类型配置键已被废弃,错误的配置参数会导致Chrome启动时配置解析失败,进而触发崩溃并抛出DevToolsActivePort file doesn't exist异常。

解决方案
  • 方案1:修正安全浏览配置的写法
    Chrome 93+版本开启安全浏览的正确配置为布尔类型的safebrowsing.enabled键,替换原有配置即可:
// 替换旧的写法 options.AddUserProfilePreference("safebrowsing", "enabled");
options.AddUserProfilePreference("safebrowsing.enabled", true);
  • 方案2:按需配置安全浏览等级(可选)
    如果需要自定义安全浏览的防护级别,可以额外添加如下配置,可选值为EnhancedProtection(增强保护)、StandardProtection(标准保护)、NoProtection(关闭保护):
options.AddUserProfilePreference("safebrowsing.security_level", "EnhancedProtection");
  • 方案3:补充Chrome启动规避参数
    如果修改配置后仍存在启动异常,可添加通用的Chrome启动兼容参数,解决沙箱、共享内存不足类的启动失败问题:
// 关闭沙箱模式,Linux/Docker环境必须添加
options.AddArgument("--no-sandbox");
// 禁用/dev/shm共享内存,避免资源不足导致崩溃
options.AddArgument("--disable-dev-shm-usage");
// 手动指定DevTools调试端口,解决DevToolsActivePort不存在的报错
options.AddArgument("--remote-debugging-port=9222");

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.05 00:24:03