Fixed intermittent SeleniumTests.test_prepopulated_fields failure.

Element would occasionally be outside of frame.
This commit is contained in:
Carlton Gibson 2020-03-25 09:58:57 +01:00 committed by GitHub
parent 10866a10fe
commit 39e1c88de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -4499,7 +4499,10 @@ class SeleniumTests(AdminSeleniumTestCase):
self.assertEqual(slug2, 'option-two-and-now-tabular-inline')
# Add an inline
self.selenium.find_elements_by_link_text('Add another Related prepopulated')[1].click()
# Button may be outside the browser frame.
element = self.selenium.find_elements_by_link_text('Add another Related prepopulated')[1]
self.selenium.execute_script('window.scrollTo(0, %s);' % element.location['y'])
element.click()
self.assertEqual(
len(self.selenium.find_elements_by_class_name('select2-selection')),
num_initial_select2_inputs + 4