19

What is the method to disable this pop-up:

Do you want Google Chrome to save your password for this site?

enter image description here

How to do this with Selenium Webdriver (Java)?

Niels van Reijmersdal
32.7k4 gold badges59 silver badges125 bronze badges
asked Mar 21, 2017 at 14:02
2
  • Recently i have updated my chrome driver to 2.28 version Commented Mar 21, 2017 at 14:09
  • Is the browser one you have control over and only used by the suite? Commented Mar 21, 2017 at 14:33

7 Answers 7

13

See the answer to "ChromeDriver user preferences ignored"

cOpt.AddUserProfilePreference("credentials_enable_service", false);
cOpt.AddUserProfilePreference("profile.password_manager_enabled", false);
answered Mar 27, 2017 at 17:21
3
  • Only credentials_enable_service is needed in my setup, but good answer. Commented 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. Commented 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. Commented Jul 21, 2017 at 18:29
8

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);
alecxe
11.4k11 gold badges52 silver badges107 bronze badges
answered Mar 30, 2017 at 10:12
1
  • 2
    This 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. Commented Apr 9, 2017 at 23:36
3

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);
answered Apr 21, 2017 at 9:23
0
1

WebDriver cannot interact with browser and/or OS specific dialogs. You can make the following changes manually in the browser to disable the dialogue.

  1. Choose the Settings menu option

  2. Click the Show advanced settings... (at the bottom of the page)

  3. In the "Passwords and forms" section, disable the Manage passwords tickbox.

answered Mar 21, 2017 at 14:37
6
  • 1
    manually i could do but i dont know how to do that in selenium web driver. Commented Mar 22, 2017 at 13:56
  • I am afraid that that isnt possible. WebDriver cannot interact with browser and/or OS specific dialogs. Commented Mar 22, 2017 at 14:24
  • some times it is coming and some times it is not coming. i dont know how to control it Commented 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. Commented 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 :-) Commented Jun 23, 2017 at 12:39
1

This works good with latest ChromeDriver:

_chrome.AddUserProfilePreference("credentials_enable_service", false);
alecxe
11.4k11 gold badges52 silver badges107 bronze badges
answered Mar 28, 2017 at 9:09
1
  • 1
    interesting option. Can you provide a link to the documentation as part of your answer? Commented Mar 28, 2017 at 10:19
0

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 
answered May 11, 2017 at 13:23
0

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();
answered Jul 9, 2017 at 8:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.