2

I am using Selenium version 3.141.59 for Java and I would like to disable password popup while initializing the driver for Chrome and Firefox.

I am using the Options syntax since the DesiredCapabilities alternative is now deprecated. My code look like this, but it is not working:

  • Firefox
FirefoxOptions options = new FirefoxOptions();
options.addPreference("signon.rememberSignons", false);
webDriver = new FirefoxDriver(options);
  • Chrome
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("credentials_enable_service", false);
chromeOptions.setExperimentalOption("profile.password_manager_enabled", false);
webDriver = new ChromeDriver(chromeOptions);

How can I add that option to the options object before creating the driver?

gonditeniz
  • 33
  • 1
  • 4

2 Answers2

5

Below are java code, which worked for me. I am using selenium 3.3.1 with selenium-chrome-driver 3.3.1 and Java 8.

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

If I understood correctly that you are referring to the built in password manager inside chrome. You may do the following to disable it without using the desired capabilities:

  1. Click the Chrome menu Chrome Menu Icon in the toolbar.
  2. Choose “Settings”
  3. Type "password" in the search bar at the top.
  4. Tab on AutoFill.
  5. Turn off the following "Offer to save passwords" and "Auto sign-in".

This step is considered to be included in the environment setup process before you start executing tests. Also, I want to highlight to you that most of the browsers are turning this off when being used in automation mode. So I think you probably should go with updating your browsers versions as a better option.

Sharaf
  • 110
  • 6