Using switch_to() in Python for a Security Warning Dialogue Box

1.8k Views Asked by At

Im getting a 'security warning' popup box in Firefox.

Im using Python and Selenium

driver.switch_to().alert().accept()

TypeError: 'SwitchTo' object is not callable

Any suggestions?

1

There are 1 best solutions below

0
Florent B. On

Here is the correct syntax:

driver.switch_to.alert.accept()

Or:

driver.switch_to_alert().accept()

Or:

Alert(driver).accept()