Skip to content

Commit 284a212

Browse files
committed
Prevent internal WebDriver issue from disrupting tests
1 parent 62e7a04 commit 284a212

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,23 @@ def open(self, url):
321321
self.driver.get(url)
322322
else:
323323
raise
324-
if (
325-
self.driver.current_url == pre_action_url
326-
and pre_action_url != url
327-
):
328-
time.sleep(0.1) # Make sure load happens
324+
try:
325+
if (
326+
self.driver.current_url == pre_action_url
327+
and pre_action_url != url
328+
):
329+
time.sleep(0.1) # Make sure load happens
330+
except Exception:
331+
time.sleep(0.1) # First see if waiting helps
332+
try:
333+
self._check_browser()
334+
if not self.driver.current_url:
335+
raise Exception("No current URL!")
336+
except Exception:
337+
# Spin up a new driver with the URL
338+
self.driver = self.get_new_driver()
339+
self.driver.get(url)
340+
self._check_browser()
329341
if settings.WAIT_FOR_RSC_ON_PAGE_LOADS:
330342
if not self.undetectable:
331343
self.wait_for_ready_state_complete()

0 commit comments

Comments
 (0)