嘗試點擊元素,但總是有一個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 –