Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebDriver Chrome Browser: Avoid 'Do you want chrome to save your password' pop up

Every time my webdriver tests login into the application, 'Do you want chrome to save your password' pop up appears.. Is there a way to avoid this??

Please help.

Thanks, Mike

like image 366
Mike Avatar asked Apr 30 '13 13:04

Mike


People also ask

How do you stop the save password pop up?

Turn Off “Save Password” Pop-Ups in Chrome for Android Here, choose the “Settings” option. Navigate to the “Passwords” section. Tap the toggle next to the “Save Passwords” option. Chrome for Android will now stop bugging you about saving usernames and passwords to your Google account.

How do I disable the Save Password bubble in Chrome using JavaScript?

First of all you must have to remove the attribute "password" of input type. The main reason behind this is when you take input type = "text" and input type = "password" major browser shows that pop up. Because browsers have inbuilt functionality to show that pop up when you take input type = "password".

How do I disable Chrome WebDriver?

We can stop a page loading with Selenium webdriver in Chrome browser by using the JavaScript Executor. Selenium can execute JavaScript commands with the help of the executeScript command. To stop a page loading, the command window. stop() is passed as a parameter to the executeScript method.


4 Answers

You need to configure the following chrome driver options:

chromeOptions: {
            prefs: {
                'credentials_enable_service': false,
                'profile': {
                    'password_manager_enabled': false
                }
            }
        }
like image 116
Karanvir Kang Avatar answered Oct 17 '22 02:10

Karanvir Kang


I'm using Python, and this worked for me:

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)
driver.get('https://google.com')
like image 22
Steve Saporta Avatar answered Oct 17 '22 02:10

Steve Saporta


Just add these preferences to your chrome driver options:

Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("credentials_enable_service", false);
prefs.put("password_manager_enabled", false); 
options.setExperimentalOption("prefs", prefs);
like image 8
Anuj Teotia Avatar answered Oct 17 '22 03:10

Anuj Teotia


Yeah I just found the answer. I had to look into the Chrome's user data directory and find all the available chromeOptions the Preferences file. I'm on Centos 7 so the path looks like this:

~/.config/google-chrome/Default/Preferences

In order to remove the save password dialog, the config JSON chromeOptions section needs to have this:

chromeOptions: {
    prefs: {
        profile: {
            password_manager_enabled: false
        }
    }
}

It really makes me happy that I have finally found these options, however, it still is disappointing that google or selenium didn't list all the configurable preferences.

like image 6
jemiloii Avatar answered Oct 17 '22 02:10

jemiloii