I'm using selenium to try to create a form autofiller for a website and I cannot seem to figure out how to block the website from asking to show notifications. Is it possible to block the website from asking this in selenium or should I try to click block?Picture of what im trying to prevent
CodePudding user response:
Add this to your options object.
Where 1 represents Allowing the notification and 2 represents Blocking.
option.add_experimental_option("prefs", {"profile.default_content_setting_values.notifications": 1})```
CodePudding user response:
Try this code:
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
option = Options()
option.add_argument('--disable-notifications')
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options = option)