diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py index 636a6ffdf2..f64a4c47f8 100644 --- a/django/contrib/admin/tests.py +++ b/django/contrib/admin/tests.py @@ -123,13 +123,21 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): """ Block until a new page has loaded and is ready. """ + from selenium.common.exceptions import WebDriverException from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as ec old_page = self.selenium.find_element(By.TAG_NAME, "html") yield # Wait for the next page to be loaded - self.wait_until(ec.staleness_of(old_page), timeout=timeout) + try: + self.wait_until(ec.staleness_of(old_page), timeout=timeout) + except WebDriverException: + # Issue in version 113+ of Chrome driver where a WebDriverException + # error is raised rather than a StaleElementReferenceException, see: + # https://issues.chromium.org/issues/42323468 + pass + self.wait_page_ready(timeout=timeout) def admin_login(self, username, password, login_url="/admin/"):