我使用的是 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);
关于c# - 忽略 ChromeDriver 用户偏好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42793277/