本文介紹了如何禁用 chrome 的“保存密碼"selenium webdriver(python)中的彈出窗口的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想在我的 selenium 測試中禁用 chrome 中的保存密碼"彈出窗口,只要它出現.我通過 ChromeOptions() 找到了一種方法,但找不到使彈出窗口消失所需的參數或首選項.
I want to disable the "save password" popup in chrome in my selenium test whenever it appears. I found a way through ChromeOptions(), but can't find the argument or preference necessary to make the popup disappear.
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("argument")
推薦答案
禁用 Google Chrome
中的 save password
彈窗 在您的 Selenium 測試中,您可以使用以下代碼塊:
To disable the save password
popup in Google Chrome
within your Selenium Tests you can use the following piece of code block:
from selenium import webdriver
chrome_opt = webdriver.ChromeOptions()
prefs = {"credentials_enable_service": False,
"profile.password_manager_enabled": False}
chrome_opt.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=chrome_opt, executable_path=r'C:UtilityBrowserDriverschromedriver.exe')
driver.get("https://google.com")
這篇關于如何禁用 chrome 的“保存密碼"selenium webdriver(python)中的彈出窗口的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!