What is the method to disable this pop-up:
Do you want Google Chrome to save your password for this site?
How to do this with Selenium Webdriver (Java)?
-
Recently i have updated my chrome driver to 2.28 versionGaneshselvan N– Ganeshselvan N2017年03月21日 14:09:14 +00:00Commented Mar 21, 2017 at 14:09
-
Is the browser one you have control over and only used by the suite?ECiurleo– ECiurleo2017年03月21日 14:33:17 +00:00Commented Mar 21, 2017 at 14:33
7 Answers 7
See the answer to "ChromeDriver user preferences ignored"
cOpt.AddUserProfilePreference("credentials_enable_service", false);
cOpt.AddUserProfilePreference("profile.password_manager_enabled", false);
-
Only credentials_enable_service is needed in my setup, but good answer.Niels van Reijmersdal– Niels van Reijmersdal2017年04月07日 09:42:26 +00:00Commented Apr 7, 2017 at 9:42
-
For Selenium Java, this should NOT be the accepted answer as there is no such method named "AddUserProfilePreference" on the ChromeOptions class.Ryan J. McDonough– Ryan J. McDonough2017年04月09日 23:35:15 +00:00Commented Apr 9, 2017 at 23:35
-
This shouldn't be the accepted answer because Chromedriver is language agnostic. I am a PHP developer using Codeception, poor, poor me.Jim Maguire– Jim Maguire2017年07月21日 18:29:56 +00:00Commented Jul 21, 2017 at 18:29
In Java:
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);
-
2This works as of Selenium 3.3.1 using selenium-chrome-driver 3.3.1 under Java 8. Thanks @Flavio Barisi all of the other comments seemed to be targeting other languages other than Java. This probably should be the accepted answer.Ryan J. McDonough– Ryan J. McDonough2017年04月09日 23:36:23 +00:00Commented Apr 9, 2017 at 23:36
What Flavio Barisi said, with the addition of the capabilities you pass to your driver.
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
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);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(capabilities);
WebDriver cannot interact with browser and/or OS specific dialogs. You can make the following changes manually in the browser to disable the dialogue.
Choose the Settings menu option
Click the Show advanced settings... (at the bottom of the page)
In the "Passwords and forms" section, disable the Manage passwords tickbox.
-
1manually i could do but i dont know how to do that in selenium web driver.Ganeshselvan N– Ganeshselvan N2017年03月22日 13:56:59 +00:00Commented Mar 22, 2017 at 13:56
-
I am afraid that that isnt possible. WebDriver cannot interact with browser and/or OS specific dialogs.ECiurleo– ECiurleo2017年03月22日 14:24:30 +00:00Commented Mar 22, 2017 at 14:24
-
some times it is coming and some times it is not coming. i dont know how to control itGaneshselvan N– Ganeshselvan N2017年03月23日 10:48:19 +00:00Commented Mar 23, 2017 at 10:48
-
@ECiurleo For some reason i have manually disabled the offer to save password option in Manage PAssword tickbox. but still when chrome opens it shows the popup.suprinder– suprinder2017年04月04日 03:07:51 +00:00Commented Apr 4, 2017 at 3:07
-
This is only half-way true. It cannot interact with the elements, but as you can see from the other answers, it can configure Chrome before startup not to show them :-)oligofren– oligofren2017年06月23日 12:39:45 +00:00Commented Jun 23, 2017 at 12:39
This works good with latest ChromeDriver:
_chrome.AddUserProfilePreference("credentials_enable_service", false);
-
1interesting option. Can you provide a link to the documentation as part of your answer?ECiurleo– ECiurleo2017年03月28日 10:19:07 +00:00Commented Mar 28, 2017 at 10:19
In Ruby:
Capybara.register_driver :selenium do |app|
preferences = {credentials_enable_service: false,
password_manager_enabled: false}
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
capabilities['chromeOptions'] = {'prefs' => preferences}
Capybara::Selenium::Driver.new(app, browser: :chrome,
desired_capabilities: capabilities)
end
In JavaScript;
import webdriver from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome';
...
const driver = new webdriver
.Builder()
.usingServer(url)
.forBrowser('chrome')
.setChromeOptions(new chrome.Options().setUserPreferences({
"credentials_enable_service": false,
"profile.password_manager_enabled": false
}))
.build();