Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何关闭python中的Chrome save password弹出窗口_Python_Python 3.x_Selenium - Fatal编程技术网

如何关闭python中的Chrome save password弹出窗口

如何关闭python中的Chrome save password弹出窗口,python,python-3.x,selenium,Python,Python 3.x,Selenium,我正在尝试关闭Chrome中的“保存密码提示”窗口。我无法控制它 我尝试了Xpath,selenium.webdriver.chrome.options(通过添加参数) 也试过 alrt = driver.switch_to_alert() alrt.dismiss() 但是没有运气 有什么帮助吗 from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.Add

我正在尝试关闭Chrome中的“保存密码提示”窗口。我无法控制它

我尝试了Xpath,
selenium.webdriver.chrome.options
(通过添加参数)

也试过

alrt = driver.switch_to_alert()
alrt.dismiss()
但是没有运气

有什么帮助吗

from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.AddUserProfilePreference("credentials_enable_service", False);
chrome_options.AddUserProfilePreference("profile.password_manager_enabled", False);

定义WebDriver时,请设置Chrome选项。Java示例:

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

对我起作用的是:

chrome_options = Options()
    chromedriver = 'C:\Jars\chromedriver.exe'
    prefs = {"profile.password_manager_enabled": False, "credentials_enable_service": False}
    chrome_options.add_experimental_option("prefs", prefs)
    driver = webdriver.Chrome(executable_path = chromedriver,chrome_options=chrome_options)

您尝试了哪些chrome选项?您想保存密码还是禁用提示?请提供您在问题中所做的尝试。我的回答是邮寄的。