0

I am working with selenium python. For a particular website, I have allowed the notifications, still after running the same website through chrome webdriver, pop up appears for the website notifications. Is there any code in the python to either accept or reject the notification by switching to it and focusing again to the website?

sameer.joshi
  • 83
  • 1
  • 6

1 Answers1

0

Try This:

browser = webdriver.Firefox()
browser.get("http:example.com")
try:
    alert = browser.switch_to_alert()
    alert.accept()
except:
    pass
browser.close()
radix
  • 198
  • 1
  • 1
  • 12