简体   繁体   中英

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
        })

this isn't working Help How can I turn off Browser Notification In selenium using python

Notifications value need to be set to 2 instead of 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)

Reference:- Handle notifications in Python + Selenium Chrome WebDriver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM