Reputation: 1046
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
Upvotes: 4
Views: 2466
Reputation: 1046
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)
Upvotes: 3