wait until expected URL is loaded #1515
Answered
by
mdmintz
poojapatel14710
asked this question in
Q&A
-
Hello sir! I am using the below code to my selenium web driver to wait until the expected URL is loaded, but I don't have any idea how to use that with the selenium base. could you please suggest to me a solution to this problem?
|
Beta Was this translation helpful? Give feedback.
Answered by
mdmintz
Sep 15, 2022
Replies: 1 comment 5 replies
-
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 |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
mdmintz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @poojapatel14710
You can do something like this:
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.