1
0
mirror of https://github.com/django/django.git synced 2025-06-03 10:39:12 +00:00

Handled WebDriverException from Chrome driver version 113+.

This commit is contained in:
Sarah Boyce 2025-03-13 12:03:56 +01:00
parent 8f400a7ff0
commit afbb8c709d

View File

@ -123,13 +123,21 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):
""" """
Block until a new page has loaded and is ready. 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.common.by import By
from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.support import expected_conditions as ec
old_page = self.selenium.find_element(By.TAG_NAME, "html") old_page = self.selenium.find_element(By.TAG_NAME, "html")
yield yield
# Wait for the next page to be loaded # 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) self.wait_page_ready(timeout=timeout)
def admin_login(self, username, password, login_url="/admin/"): def admin_login(self, username, password, login_url="/admin/"):