ChromeDriver用户首选项已被忽略

我正在使用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)); 

有没有人知道设置此首选项的“正确”方法,以便它可以工作?

你只需要更换

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