BruceyBandit
BruceyBandit

Reputation: 4334

How to select a button after page has fully loaded?

Using python and selenium, When I click on a continue button 'continue_pax', the page that loads up is the exact same page as before, so I use pax_page again to wait for the element to load up and then click on the 'continue_pax' again. However, my browser crashes when I do this. I think it maybe because it is trying to click the 'continue' button too fast.

I do get an error stating:

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

How can I click on the continue button again after page has reloaded to move onto the seats_page element?

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

Upvotes: 1

Views: 71

Answers (1)

alecxe
alecxe

Reputation: 474003

It looks like there is a modal "popup" covering the button - I suspect the loading spinner.

Two things to try:

  • wait for the Continue button to be clickable:

    wait.until(EC.element_to_be_clickable((By.ID, "pageContinue"))).click();
    
  • wait for the invisibility of the modal:

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

Upvotes: 1

Related Questions