Skip to content

Commit 725cd26

Browse files
committed
Handle a possible edge case with page loads
1 parent db3da01 commit 725cd26

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ def open(self, url):
139139
""" Navigates the current browser window to the specified page. """
140140
self.__check_scope()
141141
self.__check_browser()
142+
pre_action_url = None
143+
try:
144+
pre_action_url = self.driver.current_url
145+
except Exception:
146+
pass
142147
if type(url) is str:
143148
url = url.strip() # Remove leading and trailing whitespace
144149
if (type(url) is not str) or not self.__looks_like_a_page_url(url):
@@ -170,6 +175,11 @@ def open(self, url):
170175
self.driver.get(url)
171176
else:
172177
raise Exception(e.msg)
178+
if (
179+
self.driver.current_url == pre_action_url
180+
and pre_action_url != url
181+
):
182+
time.sleep(0.1) # Make sure load happens
173183
if settings.WAIT_FOR_RSC_ON_PAGE_LOADS:
174184
self.wait_for_ready_state_complete()
175185
self.__demo_mode_pause_if_active()

0 commit comments

Comments
 (0)