Reputation: 451
After the selenium script logins, browser gives an option to store credentials. Is there a way in Webdriver to get rid of that option?
Upvotes: 0
Views: 220
Reputation: 33
To disable the save password option, you need to add the below preferences before initializing the webdriver.
ChromeOptions options = new ChromeOptions();
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);
WebDriver driver = new ChromeDriver(options);
Upvotes: 1
Reputation: 193108
To start Chrome disabling Password Manager you need to:
Add the preferences & options to your code as follows:
System.setProperty("webdriver.chrome.driver", "C:\\SeleniumUtilities\\BrowserDrivers\\chromedriver.exe");
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_setting_values.notifications", 2);
prefs.put("credentials_enable_service", false);
prefs.put("profile.password_manager_enabled", false);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(capabilities);
driver.get("http:\\gmail.com");
Let me know if this helps you.
Upvotes: 0