【问题标题】:ChromeDriver user preferences ignored已忽略 ChromeDriver 用户首选项
【发布时间】:2017-03-14 17:57:17
【问题描述】:

我正在使用 Selenium webdriver 3.3 和 ChromeDriver 2.28(32 位)。我的从机是运行 Chrome 57 的 Windows 7。

当 Chrome 启动时,我尝试通过 RemoteWebDriver 使用 ChromeOptions 来禁用使用参数“password_manager_enabled”的“保存密码”弹出窗口。

但是,它似乎完全没有效果。我已经尝试了很多关于 ChromeOptions、JSON 字符串和简单字符串的变体,但都无济于事。

ChromeOptions cOpt = new ChromeOptions();
cOpt.addUserProfilePreference("profile.password_manager_enabled", false);
var capabilities = chromeOpts.ToCapabilities() as DesiredCapabilities;
// Add OS, Platform capabilities etc
string gridConnectionURL = "xxxx"
driver = new CustomRemoteDriver(new Uri(gridConnectionURL), capabilities, new TimeSpan(0, 5, 0));

有没有人知道设置此首选项的“正确”方法以使其起作用?

【问题讨论】:

  • 我刚刚意识到 ChromeDriver 似乎在 C:\Users\\AppData\Local\Temp 位置创建了一个临时配置文件。当我查看此配置文件时,会出现设置。但 Chrome 似乎忽略了它。

标签: c# google-chrome selenium selenium-webdriver selenium-chromedriver


【解决方案1】:

你只需要替换

//cOpt.AddUserProfilePreference("password_manager_enabled", "false");
cOpt.AddUserProfilePreference("credentials_enable_service", false);
cOpt.AddUserProfilePreference("profile.password_manager_enabled", false);

【讨论】:

    猜你喜欢
    • 2021-09-04
    • 2020-05-06
    • 1970-01-01
    • 1970-01-01
    • 2015-04-17
    • 2021-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多