我试图做警报异常处理,我已经尝试了一些选项,但我似乎不能得到脚本来尝试异常,它只是错误。
#Add Alert Bypass
try:
driver.switch_to.default_content()
except NoAlertPresentException:
print('Alert Popup')
alert = driver.switch_to.alert()
alert.dismiss()
错误消息:
Message: unexpected alert open: {Alert text : ...}
发布于 2018-06-01 04:42:44
根据错误消息,您似乎使用了错误的selenium.common.exceptions
。这看起来像是意外警报。我会尝试使用UnexpectedAlertPresentException
而不是NoAlertPresentException
https://stackoverflow.com/questions/50630069
复制相似问题