【问题标题】:How to select a button after page has fully loaded?页面完全加载后如何选择按钮?
【发布时间】:2016-02-08 22:16:55
【问题描述】:

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

我确实收到一条错误消息:

, 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")))

【问题讨论】:

    标签: python python-2.7 selenium


    【解决方案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")))
      

    【讨论】:

    猜你喜欢
    • 2017-03-22
    • 2014-08-09
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多