我发现了这个答案https://dev59.com/dmMk5IYBdhLWcg3wvQcU#19019311,它等待警报出现,但是我需要相反的效果,以便运行宏的人有时间在代理弹出窗口上进行身份验证。是否有与下面代码相反的代码?
WebDriverWait(browser, 60).until(EC.alert_is_present())
我发现了这个答案https://dev59.com/dmMk5IYBdhLWcg3wvQcU#19019311,它等待警报出现,但是我需要相反的效果,以便运行宏的人有时间在代理弹出窗口上进行身份验证。是否有与下面代码相反的代码?
WebDriverWait(browser, 60).until(EC.alert_is_present())
alert_is_not_present
自定义预期条件: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