4

I found two examples on Stack Overflow on disabling notifications, but neither of these has worked for me: push notifications are still showing when the browser is launched. Here is the code that I've tried:

Example 1:

browser_profile = webdriver.FirefoxProfile()
browser_profile.set_preference("dom.webnotifications.enabled", False)
driver = webdriver.Firefox(firefox_profile=browser_profile)

Example 2:

from selenium.webdriver.firefox.options import Options
options = Options()
options.set_preference("dom.webnotifications.enabled", False)
browser = webdriver.Firefox(firefox_options=options)

Notification

enter image description here

2
  • Can you update the question with the snapshot of the notification which you want to disable? Commented Nov 18, 2018 at 15:33
  • @DebanjanB updated question with a screenshot Commented Nov 18, 2018 at 17:21

1 Answer 1

3

Found solution from official Firefox website https://support.mozilla.org/en-US/kb/push-notifications-firefox

options = webdriver.FirefoxOptions()
options.set_preference("dom.push.enabled", False)
browser = webdriver.Firefox(firefox_options=options)
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.