Skip to content Skip to sidebar Skip to footer

How To Disable Notification Popup In Chrome Browser

from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options import time chrome_options = webdriver.ChromeOp

Solution 1:

As you have created an instance of ChromeOptions() as chrome_options you need to pass it as an argument to put the configurations in effect while invoking webdriver.Chrome() as follows :

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications" : 2}
chrome_options.add_experimental_option("prefs", prefs)
chrome_options.add_argument("start-maximized")
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'C:\path\to\chromedriver.exe')
driver.get("https://www.arttoframe.com/")
time.sleep(6)
driver.quit()

Note :

  • To maximize the Chrome browser instead of maximize_window() use the ChromeOptions() class argument start-maximized
  • At the end of your program instead of driver.close() use driver.quit().

Solution 2:

driver.switch_to_alert().dismiss()
driver.switch_to_alert().accept()

These can be used dismiss-right and accept-left

Post a Comment for "How To Disable Notification Popup In Chrome Browser"