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

如何在Chrome自动化测试中禁用Google Password Manager弹窗

禁用Chrome自动化测试中的Google密码管理器弹窗

针对Chrome 135.0.7049.42 + Selenium.WebDriver 4.30的场景,可通过以下几种方式彻底关闭Google密码管理器弹窗:

方法一:添加Chrome启动参数

直接通过启动参数禁用密码管理器核心功能,是最直接的解决方案:

  • --disable-features=PasswordManager:关闭密码管理器相关特性
  • --disable-password-manager-reauthentication:禁用密码管理器的重验证弹窗
  • --password-manager-enable=false:全局关闭密码管理器功能

以C#代码为例:

ChromeOptions options = new ChromeOptions();
options.AddArgument("--disable-features=PasswordManager");
options.AddArgument("--disable-password-manager-reauthentication");
options.AddArgument("--password-manager-enable=false");

IWebDriver driver = new ChromeDriver(options);

方法二:配置用户偏好关闭密码提示

同时添加用户偏好设置,避免触发保存密码的提示(和方法一结合使用效果更佳):

options.AddUserProfilePreference("credentials_enable_service", false);
options.AddUserProfilePreference("profile.password_manager_enabled", false);

注意事项

  • 确保ChromeDriver版本与Chrome浏览器版本完全匹配(你当前使用的135.0.7049.42是匹配的,无需调整)
  • 若仍有弹窗,可尝试清除浏览器缓存或使用全新的用户配置文件启动Chrome

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.13 13:04:57