【问题标题】:Prevent ChromeDriver save password prompt - Selenium Python防止 ChromeDriver 保存密码提示 - Selenium Python
【发布时间】:2022-01-21 22:44:37
【问题描述】:

在 python 3.9 中使用最新的 ChromeDriver 和 selenium,建议添加到选项的参数目前在我的两台机器上不起作用。

尝试了列出的所有答案 herehere ,根据文档应该是正确的。我必须忽略一些我找不到的东西。 仍然会收到来自 Chrome 的提示,询问我是否要保存用户名和密码。而且由于它是一个自动化程序,因此不需要。

    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)

根据检查的所有来源,将 "credentials_enable_service" 和 "profile.password_manager_enabled" 设置为 False 就足够了。

欢迎任何提示。 我尝试使用不同的方法来导入选项,但它们都不起作用

【问题讨论】:

    标签: python selenium automation selenium-chromedriver


    【解决方案1】:

    您是否尝试过使用这些参数?

    options.add_argument("--no-first-run --no-service-autorun --password-store=basic")

    【讨论】:

    • 那不起作用,仍然得到提示并且控制台中没有相关信息...imgur.com/a/gbqn5yZ
    猜你喜欢
    • 2021-12-26
    • 1970-01-01
    • 2017-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多