Skip to content

wait until expected URL is loaded #1515

Answered by mdmintz
poojapatel14710 asked this question in Q&A

You must be logged in to vote

Hi @poojapatel14710

You can do something like this:

from selenium.webdriver.support.ui import WebDriverWait
from seleniumbase import BaseCase

class MyTestClass(BaseCase):
    def test_base(self):
        self.open("https://www.google.com/")
        wait = WebDriverWait(self.driver, 4)
        wait.until(lambda driver: driver.current_url == "https://www.google.com/")

And that will succeed assuming you're not redirected to a different URL. In the specific example above, the WebDriverWait is unnecessary, because SeleniumBase automatically waits for a page to finish loading before resuming automation.

Replies: 1 comment 5 replies

You must be logged in to vote
5 replies
@poojapatel14710

@mdmintz

@poojapatel14710

@mdmintz

@poojapatel14710

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants