ChromeDriver用户首选项被忽略

时间:2017-03-14 17:57:18

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

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

当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));

有谁知道"正确"如何设置此首选项以使其有效?

1 个答案:

答案 0 :(得分:8)

您只需要替换

//cOpt.AddUserProfilePreference("password_manager_enabled", "false");
cOpt.AddUserProfilePreference("credentials_enable_service", false);
cOpt.AddUserProfilePreference("profile.password_manager_enabled", false);
相关问题