尝试点击元素,但总是有一个UnexpectedAlertPresentException.Adding UnexpectedAlertPresentException给代码不要chage任何东西,因为元素没有被点击和弹出不appeard.I想可能是它的原因弹出没有太多时间出现,但它也没有帮助。 事件试着接受通过能力都弹出...无法点击元素由于弹出
cap = DesiredCapabilities.FIREFOX
cap["UnexpectedAlertPresentException"] = "accept"
fox = webdriver.Firefox(capabilities=cap)
fox.find_element_by_link_text("My Account").click()
try:
WebDriverWait(fox, 3).until(EC.alert_is_present(),
'Timed out waiting for PA creation ' +
'confirmation popup to appear.')
fox.switch_to.alert().accept()
print "alert accepted"
except TimeoutException:
print "no alert"
我有python 2.7 –