18

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

  • Recently i have updated my chrome driver to 2.28 version – Ganeshselvan N Mar 21 '17 at 14:09
  • Is the browser one you have control over and only used by the suite? – ECiurleo Mar 21 '17 at 14:33
12

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 Apr 7 '17 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 Apr 9 '17 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 Jul 21 '17 at 18:29
7

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);
  • 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. – Ryan J. McDonough Apr 9 '17 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);
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.

  • 1
    manually i could do but i dont know how to do that in selenium web driver. – Ganeshselvan N Mar 22 '17 at 13:56
  • I am afraid that that isnt possible. WebDriver cannot interact with browser and/or OS specific dialogs. – ECiurleo Mar 22 '17 at 14:24
  • some times it is coming and some times it is not coming. i dont know how to control it – Ganeshselvan N Mar 23 '17 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 Apr 4 '17 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 Jun 23 '17 at 12:39
1

This works good with latest ChromeDriver:

_chrome.AddUserProfilePreference("credentials_enable_service", false);
  • 1
    interesting option. Can you provide a link to the documentation as part of your answer? – ECiurleo Mar 28 '17 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  
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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.