-1

I want to automate something but getting stuck whenever a notifications arrive in chrome with allow and block options. How to handle this notification?

I've tried to click on the body or hit escape button through selenium but it's not working.

  • 1
    Possible duplicate of [How to click Allow on Show Notifications popup using Selenium Webdriver](https://stackoverflow.com/questions/38684175/how-to-click-allow-on-show-notifications-popup-using-selenium-webdriver) – PixelEinstein Jul 17 '19 at 15:27

1 Answers1

1

Check if any alert exists using selenium with python will show you how to switch to the alert. From there you can accept or decline it.

WebDriverWait(browser, 3).until(EC.alert_is_present(),
                               'Timed out waiting for alert')

alert = browser.switch_to.alert
alert.accept() [or alert.dismiss()]
jmq
  • 1,559
  • 9
  • 21