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?
Asked
Active
Viewed 217 times
0
-
have you tried https://stackoverflow.com/questions/8631500/click-the-javascript-popup-through-webdriver ? – AutomatedOwl Dec 13 '18 at 11:51
1 Answers
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