使用selenium处理chrome中的保存密码promt

时间:2017-04-14 08:53:07

标签: java google-chrome selenium authentication

任何人都可以让我知道如何使用selenium与java禁用谷歌浏览器中的保存密码提示,我刚刚将我的驱动程序更新为2.29版本。我使用的是Windows 10和chrome版本是57.0.2987.133。请注意我是使用selenium 3.0.1。另外,我在google上经历了很多帖子,但似乎没有任何工作。谢谢提前

2 个答案:

答案 0 :(得分:0)

尝试以下:

ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
options.addArguments("--disable-web-security");
options.addArguments("--no-proxy-server");
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("credentials_enable_service", false);
prefs.put("profile.password_manager_enabled", false);
options.setExperimentalOption("prefs", prefs);

答案 1 :(得分:0)

以这种方式调用Chrome。

System.setProperty("webdriver.chrome.driver","path to chromedriver.exe");
     ChromeOptions options = new ChromeOptions();
     options.addArguments("--incognito");
     DesiredCapabilities capabilities = DesiredCapabilities.chrome();
     capabilities.setCapability(ChromeOptions.CAPABILITY, options);
     WebDriver driver=new ChromeDriver(capabilities);