Python Selenium: tidak menunggu sampai halaman dimuat setelah perintah klik ()

def wait_for_visibility(self, selector, timeout_seconds=10):
    retries = timeout_seconds
    while retries:
        try:
            element = self.get_via_css(selector)
            if element.is_displayed():
                return element
        except (exceptions.NoSuchElementException,
                exceptions.StaleElementReferenceException):
            if retries <= 0:
                raise
            else:
                pass

        retries = retries - 1
        time.sleep(pause_interval)
    raise exceptions.ElementNotVisibleException(
        "Element %s not visible despite waiting for %s seconds" % (
            selector, timeout_seconds)
    )
Mappy Show