[Python] Python Selenium. Wait for page fully loaded

Discussão em 'Python' iniciado por Stack, Agosto 20, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to implement website automation. Before I start to interact with website, I have to wait until page is fully loaded. The website work with great amount of data and fetching it from database. So the loading takes few seconds (depends on internet speed).

    I tried to use time.sleep(10), but is not stable. How I said before, the loading depends of internet speed. So, one time it works, another one not.

    Also i tried:

    wait.until(
    lambda driver: driver.execute_script("return document.readyState") == "complete"
    )


    It didn't work. It looks for DOM to be appeared, but DOM is changing right as data is fetched from database.

    Explicit wait is also not a solution. On website i have multiple pages. Navigating on any of them requires time for loading. There are no same elements on all pages. So I can't rely on this solution.

    I need universal waiter for page to be fully loaded with fetched data. How to make it? I didn't found answer on internet.

    Continue reading...

Compartilhe esta Página