test: Fix selectors in selenium tests

This commit is contained in:
Jennifer Richards 2023-05-19 17:54:24 -03:00
parent 2a29be5d6a
commit 58182fd7f6
No known key found for this signature in database
GPG key ID: 9B2BF5C5ADDA6A6E
2 changed files with 4 additions and 4 deletions

View file

@ -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]
)
)

View file

@ -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
return child if child is not None else False