File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff 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()
You can’t perform that action at this time.
0 commit comments