7

I found this answer https://stackoverflow.com/a/19019311/1998220 that waits until the alert is present, but I need the opposite so whoever runs the macro has time to authenticate on the proxy pop up. Is there an opposite to the below code?

WebDriverWait(browser, 60).until(EC.alert_is_present())
Community
  • 1
  • 1
Michael St Clair
  • 5,064
  • 7
  • 51
  • 70

1 Answers1

10

You can wait for a specific URL, title, or a specific element to be present or visible, but you can also have a specific alert_is_not_present custom Expected Condition:

class alert_is_not_present(object):
    """ Expect an alert to not to be present."""
    def __call__(self, driver):
        try:
            alert = driver.switch_to.alert
            alert.text
            return False
        except NoAlertPresentException:
            return True
alecxe
  • 441,113
  • 110
  • 1,021
  • 1,148