Handle notifications in Python + Selenium Chrome WebDriver

后端 未结 4 1377
醉酒成梦
醉酒成梦 2020-12-03 19:07

How can Selenium Chrome WebDriver notifications be handled in Python?

Have tried to dismiss/accept alert and active element but seems notif

4条回答
  •  庸人自扰
    2020-12-03 19:55

    You can disable the browser notifications, using chrome options.

    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)
    

提交回复
热议问题