Save Password for This Website dialog box with ChromeDriver, although many command line options try to suppress such pop-ups

I get the "save password" dialog when creating ChromeDriver as follows:

var options = new ChromeOptions();

options.AddArguments("chrome.switches", "--disable-extensions --disable-extensions-file-access-check --disable-extensions-http-throttling --disable-infobars --enable-automation --start-maximized");
var driver = new ChromeDriver(options);

And go to the login form and submit it.

How to get rid of a popup?

+6
source share
3 answers

You need to add these settings:

options.AddUserProfilePreference("credentials_enable_service", false);
options.AddUserProfilePreference("profile.password_manager_enabled", false);

So your final code will look like this:

 var options = new ChromeOptions();

 options.AddArguments("chrome.switches", "--disable-extensions --disable-extensions-file-access-check --disable-extensions-http-throttling --disable-infobars --enable-automation --start-maximized");
 options.AddUserProfilePreference("credentials_enable_service", false);
 options.AddUserProfilePreference("profile.password_manager_enabled", false);
 var driver = new ChromeDriver(options);
+14
source

, Java, . , , Java :

        ChromeOptions chOption = new ChromeOptions();
        chOption.addArguments("--disable-extensions");
        chOption.addArguments("test-type");
        Map<String, Object> prefs = new HashMap<String, Object>();
        prefs.put("credentials_enable_service", false);
        prefs.put("profile.password_manager_enabled", false);
        chOption.setExperimentalOption("prefs", prefs);
        driver = new ChromeDriver(chOption);
+1

Here is an implementation for Python users:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_experimental_option('prefs', {
    'credentials_enable_service': False,
    'profile': {
        'password_manager_enabled': False
    }
})
driver = webdriver.Chrome(chrome_options=chrome_options)
0
source

Source: https://habr.com/ru/post/1016307/


All Articles