Skip to content

Commit c1bac59

Browse files
committed
Make sure URL has fully loaded before asserting the title
1 parent c8eb846 commit c1bac59

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,11 +2918,20 @@ def assert_raises(self, *args, **kwargs):
29182918

29192919
def assert_title(self, title):
29202920
""" Asserts that the web page title matches the expected title. """
2921+
self.wait_for_ready_state_complete()
29212922
expected = title
29222923
actual = self.get_page_title()
2923-
self.assertEqual(expected, actual, "Expected page title [%s] "
2924-
"does not match the actual page title [%s]!"
2925-
"" % (expected, actual))
2924+
try:
2925+
self.assertEqual(expected, actual, "Expected page title [%s] "
2926+
"does not match the actual page title [%s]!"
2927+
"" % (expected, actual))
2928+
except Exception:
2929+
self.wait_for_ready_state_complete()
2930+
self.sleep(settings.MINI_TIMEOUT)
2931+
actual = self.get_page_title()
2932+
self.assertEqual(expected, actual, "Expected page title [%s] "
2933+
"does not match the actual page title [%s]!"
2934+
"" % (expected, actual))
29262935
if self.demo_mode:
29272936
a_t = "ASSERT TITLE"
29282937
if self._language != "English":

0 commit comments

Comments
 (0)