2

我想在我的硒测试中出现时在chrome中禁用“保存密码”弹出窗口。我通过ChromeOptions()找到了一种方法,但无法找到使弹出消失所需的参数或偏好。如何在selenium webdriver中禁用chrome的“保存密码”弹出窗口(python)

from selenium.webdriver.chrome.options import Options 
chrome_options = Options() 
chrome_options.add_argument("argument") 
+0

它不应该影响你的测试,你为什么需要禁用它? – JeffC

+0

你有没有试过[this?](https://stackoverflow.com/questions/43223857/save-password-for-this-website-dialog-with-chromedriver-despite-numerous-comm)。看看底部的答案。 – Pan

回答

0

相关选项为您的Selenium测试中禁用Google Chromesave password弹出你可以用下面这段代码块:

from selenium import webdriver 

chrome_opt = webdriver.ChromeOptions() 
prefs = {"credentials_enable_service", False} 
prefs = {"profile.password_manager_enabled" : False} 
chrome_opt.add_experimental_option("prefs", prefs) 
driver = webdriver.Chrome(chrome_options=chrome_opt, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe') 
driver.get("https://google.com") 
0

以下选项将禁用“保存密码”弹出窗口。但这是在C#中。

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

你可以找到蟒蛇here

相关问题