如何在 python 的 selenium webdriver 中禁用 chrome 通知弹出窗口
how to disable chrome notifications popup in selenium webdriver in python
from selenium.webdriver.chrome.options import Options
opt = Options()
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_argument("--disable-extensions")
opt.add_experimental_option("prefs", {\
"profile.default_content_setting_values.notifications":1
})
这不起作用帮助
如何使用 python
在 selenium 中关闭浏览器通知
通知值需要设置为 2 而不是 1
chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
参考:-
from selenium.webdriver.chrome.options import Options
opt = Options()
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_argument("--disable-extensions")
opt.add_experimental_option("prefs", {\
"profile.default_content_setting_values.notifications":1
})
这不起作用帮助 如何使用 python
在 selenium 中关闭浏览器通知通知值需要设置为 2 而不是 1
chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
参考:-