Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent ChromeDriver save password prompt - Selenium Python

Using latest ChromeDriver and selenium in python 3.9 , the recommended arguments to be added to options are not currently working in 2 of my machines.

Tried all the answers listed here and here , that according to docs should be correct . I must be overlooking something that I cant find. Still get a prompt from Chrome asking if I want to save the username and password. And since its an automated procedure , this is not needed .

    options = webdriver.ChromeOptions()
    prefs = {"profile.default_content_setting_values.notifications" : 2,
             "credentials_enable_service", False, 
             "profile.password_manager_enabled", False}

options.add_experimental_option("prefs",prefs)
options.add_experimental_option("useAutomationExtension", False)
options.add_experimental_option("excludeSwitches",["enable-automation"])
options.add_argument('--disable-extensions')
options.add_argument('--no-sandbox')
options.add_argument("--log-level=3")
options.add_experimental_option("prefs", {"intl.accept_languages": "en-EN"})

mobile_emulation = {
    "userAgent": "Mozilla/5.0 (Linux; Android 11; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Mobile Safari/537.36"}

options.add_experimental_option("mobileEmulation", mobile_emulation)
browser = webdriver.Chrome(options=options)

According to all sources checked , setting "credentials_enable_service" and "profile.password_manager_enabled" to False , should be enough .

Any hints welcomed . I tried using different methods to import options but none of them work

like image 805
Carlo Cattano Avatar asked Sep 12 '26 17:09

Carlo Cattano


1 Answers

options = uc.ChromeOptions()
options.add_argument("--password-store=basic")
options.add_experimental_option(
    "prefs",
    {
        "credentials_enable_service": False,
        "profile.password_manager_enabled": False,
    },
)
driver = uc.Chrome(options=options)
like image 144
Dartagnan Avatar answered Sep 14 '26 15:09

Dartagnan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!