From 58182fd7f600f2a89ecb73e4efb96df75cca64a8 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Fri, 19 May 2023 17:54:24 -0300 Subject: [PATCH] test: Fix selectors in selenium tests --- ietf/doc/tests_js.py | 4 ++-- ietf/utils/jstest.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ietf/doc/tests_js.py b/ietf/doc/tests_js.py index 02daaae90..ac63c0995 100644 --- a/ietf/doc/tests_js.py +++ b/ietf/doc/tests_js.py @@ -118,7 +118,7 @@ class EditAuthorsTests(IetfSeleniumTestCase): # Must provide a "basis" (change reason) self.driver.find_element(By.ID, 'id_basis').send_keys('change testing') # Now click the 'submit' button and check that the update was accepted. - submit_button = self.driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]') + submit_button = self.driver.find_element(By.CSS_SELECTOR, '#content button[type="submit"]') self.driver.execute_script("arguments[0].click();", submit_button) # FIXME: no idea why this fails: # self.scroll_to_element(submit_button) # submit_button.click() @@ -132,4 +132,4 @@ class EditAuthorsTests(IetfSeleniumTestCase): self.assertEqual( list(draft.documentauthor_set.values_list('person', flat=True)), [first_auth.person.pk] + [auth.pk for auth in authors] - ) \ No newline at end of file + ) diff --git a/ietf/utils/jstest.py b/ietf/utils/jstest.py index 722b40581..a901df66f 100644 --- a/ietf/utils/jstest.py +++ b/ietf/utils/jstest.py @@ -81,7 +81,7 @@ class IetfSeleniumTestCase(IetfLiveServerTestCase): self.driver.get(url) self.driver.find_element(By.NAME, 'username').send_keys(username) self.driver.find_element(By.NAME, 'password').send_keys(password) - self.driver.find_element(By.XPATH, '//button[@type="submit"]').click() + self.driver.find_element(By.XPATH, '//*[@id="content"]//button[@type="submit"]').click() def scroll_to_element(self, element): """Scroll an element into view""" @@ -108,4 +108,4 @@ class presence_of_element_child_by_css_selector: def __call__(self, driver): child = self.element.find_element(By.CSS_SELECTOR, self.child_selector) - return child if child is not None else False \ No newline at end of file + return child if child is not None else False