ChromeDriver用户首选项被忽略 [英] ChromeDriver user preferences ignored

查看:134
本文介绍了ChromeDriver用户首选项被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using Selenium webdriver 3.3 and ChromeDriver 2.28 (32bit). My slave machine is Windows 7 running Chrome 57.

Chrome启动时,我尝试使用RemoteWebDriver上的ChromeOptions通过参数"password_manager_enabled"禁用保存密码"弹出窗口.

When Chrome starts I am trying to use ChromeOptions over RemoteWebDriver to disable the "save your password" pop-up using the parameter "password_manager_enabled".

但是,它似乎根本没有任何作用.我已经尝试过关于ChromeOptions,JSON字符串和简单字符串的多种变体,但无济于事.

However, it seems to have no effect at all. I have tried many variations around ChromeOptions, JSON strings and simple strings but all to no avail.

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

有人知道设置此首选项的正确"方法吗?

Does anyone know the "correct" way to set this preference so it works?

推荐答案

您只需要替换

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

这篇关于ChromeDriver用户首选项被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆