3
 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

3
  • what kind of notifications? Those allow/block notifications types? Commented Nov 22, 2020 at 17:14
  • yes allow/block types Commented Nov 22, 2020 at 17:18
  • Like notification allow and disallow Commented Nov 22, 2020 at 17:18

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.