diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py index 1e51542fa2..36e2fe5c90 100644 --- a/django/contrib/admin/tests.py +++ b/django/contrib/admin/tests.py @@ -116,8 +116,9 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): """ Block until a new page has loaded and is ready. """ + 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') + 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) @@ -127,22 +128,24 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): """ Log in to the admin. """ + from selenium.webdriver.common.by import By self.selenium.get('%s%s' % (self.live_server_url, login_url)) - username_input = self.selenium.find_element_by_name('username') + username_input = self.selenium.find_element(By.NAME, 'username') username_input.send_keys(username) - password_input = self.selenium.find_element_by_name('password') + password_input = self.selenium.find_element(By.NAME, 'password') password_input.send_keys(password) login_text = _('Log in') with self.wait_page_loaded(): - self.selenium.find_element_by_xpath('//input[@value="%s"]' % login_text).click() + self.selenium.find_element(By.XPATH, '//input[@value="%s"]' % login_text).click() def select_option(self, selector, value): """ Select the