无法允许可能不是警报的通知

时间:2018-07-20 10:37:42

标签: python python-3.x selenium selenium-chromedriver python-3.5

如@DebanjanB所建议,在WebDriverWait startsWebDriverWait ends消息之间清晰可见的弹出窗口可能不是警报。在这种情况下,我们如何按“允许”。

enter image description here

chrome_options = webdriver.ChromeOptions()
prefs = { "profile.default_content_setting_values.notifications" : 2 }
chrome_options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=CHROME_DRIVER_PATH)
driver.get(url)
try:
    print("WebDriverWait starts")
    WebDriverWait(driver, 10).until(EC.alert_is_present(), 'Timed out waiting for PA creation confirmation popup to appear.')
    alert = driver.switch_to.alert
    alert.accept()
    print("alert accepted")
except TimeoutException as e:
    print("WebDriverWait ends: ", e)
    pass
  

WebDriverWait启动

     

WebDriverWait结束:消息:等待PA创建确认弹出窗口超时。

0 个答案:

没有答案
相关问题