页面完全加载后如何选择按钮?

时间:2016-02-08 22:16:55

标签: python python-2.7 selenium

使用python和selenium,当我单击继续按钮'continue_pax'时,加载的页面与之前的页面完全相同,因此我再次使用pax_page等待元素加载向上然后再次单击'continue_pax'。但是,当我这样做时,我的浏览器崩溃了。我想也许是因为它试图点击“继续”#39;按钮太快了。

我收到错误声明:

, line 193, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: Element is not clickable at point (834.5, 562). Other element would receive the click: <div class="modal-outer"></div>

如何在重新加载页面后再次单击“继续”按钮以移至seats_page元素?

pax_page = wait.until(EC.visibility_of_element_located((By.ID, "ctl00_MainContent_passengerList_PassengerGridView_ctl08_butAddBagsForAll")))

... filling for code in between

    #continue to seats
    continue_pax = driver.find_element_by_id("pageContinue").click()
    pax_page
    continue_pax
    seats_page = wait.until(EC.visibility_of_element_located((By.ID, "findyourseat")))

1 个答案:

答案 0 :(得分:1)

看起来有一个模态“弹出窗口”覆盖按钮 - 我怀疑加载微调器

要尝试两件事:

  • 等待Continue按钮可点击

    wait.until(EC.element_to_be_clickable((By.ID, "pageContinue"))).click();
    
  • 等待模态的隐身

    wait.until(EC.invisibility_of_element_located((By.CLASS_NAME, "modal-outer")))