[Python] Wait untill Page_loaded in selenium

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

  1. Stack

    Stack Membro Participativo

    I am new to selenium and building a project (Python + Selenium). I have inserted a custom wait in code like time.sleep(10).

    The thing I am trying to implement is: the code should be block until a page has been loaded fully and same after button clicks.

    I have gone through few reading like

    implicit wait
    explicit wait
    wait until an element appears up (select by id or something else )


    Is there any way to block the code until a page has been loaded fully. (I do not have any condition upon which i can wait for wait until). I can not use stuffs implicit wait or explicit as there is no fix time for completion of loading a page

    def run(self):
    self.browser.get('url')
    # here it should wait until the page has been loaded fully
    time.sleep(10)
    element = self.browser.find_element_by_css_selector('some-css-selector')

    Continue reading...

Compartilhe esta Página