Removed usage of deprecated switch_to_*() selenium methods.

This commit is contained in:
Tim Graham 2014-07-24 08:25:15 -04:00
parent 8568e7cfa4
commit 9b1515906e
2 changed files with 12 additions and 12 deletions

View File

@ -3724,7 +3724,7 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
self.selenium.get('%s%s' % (self.live_server_url, self.selenium.get('%s%s' % (self.live_server_url,
'/test_admin/admin/admin_views/picture/add/')) '/test_admin/admin/admin_views/picture/add/'))
self.assertEqual( self.assertEqual(
self.selenium.switch_to_active_element(), self.selenium.switch_to.active_element,
self.selenium.find_element_by_id('id_name') self.selenium.find_element_by_id('id_name')
) )
@ -3732,7 +3732,7 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
self.selenium.get('%s%s' % (self.live_server_url, self.selenium.get('%s%s' % (self.live_server_url,
'/test_admin/admin/admin_views/reservation/add/')) '/test_admin/admin/admin_views/reservation/add/'))
self.assertEqual( self.assertEqual(
self.selenium.switch_to_active_element(), self.selenium.switch_to.active_element,
self.selenium.find_element_by_id('id_start_date_0') self.selenium.find_element_by_id('id_start_date_0')
) )

View File

@ -985,26 +985,26 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
# Open the popup window and click on a band # Open the popup window and click on a band
self.selenium.find_element_by_id('lookup_id_main_band').click() self.selenium.find_element_by_id('lookup_id_main_band').click()
self.selenium.switch_to_window('id_main_band') self.selenium.switch_to.window('id_main_band')
self.wait_page_loaded() self.wait_page_loaded()
link = self.selenium.find_element_by_link_text('Bogey Blues') link = self.selenium.find_element_by_link_text('Bogey Blues')
self.assertTrue('/band/42/' in link.get_attribute('href')) self.assertTrue('/band/42/' in link.get_attribute('href'))
link.click() link.click()
# The field now contains the selected band's id # The field now contains the selected band's id
self.selenium.switch_to_window(main_window) self.selenium.switch_to.window(main_window)
self.wait_for_value('#id_main_band', '42') self.wait_for_value('#id_main_band', '42')
# Reopen the popup window and click on another band # Reopen the popup window and click on another band
self.selenium.find_element_by_id('lookup_id_main_band').click() self.selenium.find_element_by_id('lookup_id_main_band').click()
self.selenium.switch_to_window('id_main_band') self.selenium.switch_to.window('id_main_band')
self.wait_page_loaded() self.wait_page_loaded()
link = self.selenium.find_element_by_link_text('Green Potatoes') link = self.selenium.find_element_by_link_text('Green Potatoes')
self.assertTrue('/band/98/' in link.get_attribute('href')) self.assertTrue('/band/98/' in link.get_attribute('href'))
link.click() link.click()
# The field now contains the other selected band's id # The field now contains the other selected band's id
self.selenium.switch_to_window(main_window) self.selenium.switch_to.window(main_window)
self.wait_for_value('#id_main_band', '98') self.wait_for_value('#id_main_band', '98')
def test_many_to_many(self): def test_many_to_many(self):
@ -1020,26 +1020,26 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
# Open the popup window and click on a band # Open the popup window and click on a band
self.selenium.find_element_by_id('lookup_id_supporting_bands').click() self.selenium.find_element_by_id('lookup_id_supporting_bands').click()
self.selenium.switch_to_window('id_supporting_bands') self.selenium.switch_to.window('id_supporting_bands')
self.wait_page_loaded() self.wait_page_loaded()
link = self.selenium.find_element_by_link_text('Bogey Blues') link = self.selenium.find_element_by_link_text('Bogey Blues')
self.assertTrue('/band/42/' in link.get_attribute('href')) self.assertTrue('/band/42/' in link.get_attribute('href'))
link.click() link.click()
# The field now contains the selected band's id # The field now contains the selected band's id
self.selenium.switch_to_window(main_window) self.selenium.switch_to.window(main_window)
self.wait_for_value('#id_supporting_bands', '42') self.wait_for_value('#id_supporting_bands', '42')
# Reopen the popup window and click on another band # Reopen the popup window and click on another band
self.selenium.find_element_by_id('lookup_id_supporting_bands').click() self.selenium.find_element_by_id('lookup_id_supporting_bands').click()
self.selenium.switch_to_window('id_supporting_bands') self.selenium.switch_to.window('id_supporting_bands')
self.wait_page_loaded() self.wait_page_loaded()
link = self.selenium.find_element_by_link_text('Green Potatoes') link = self.selenium.find_element_by_link_text('Green Potatoes')
self.assertTrue('/band/98/' in link.get_attribute('href')) self.assertTrue('/band/98/' in link.get_attribute('href'))
link.click() link.click()
# The field now contains the two selected bands' ids # The field now contains the two selected bands' ids
self.selenium.switch_to_window(main_window) self.selenium.switch_to.window(main_window)
self.wait_for_value('#id_supporting_bands', '42,98') self.wait_for_value('#id_supporting_bands', '42,98')
@ -1067,7 +1067,7 @@ class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
main_window = self.selenium.current_window_handle main_window = self.selenium.current_window_handle
# Click the Add User button to add new # Click the Add User button to add new
self.selenium.find_element_by_id('add_id_user').click() self.selenium.find_element_by_id('add_id_user').click()
self.selenium.switch_to_window('id_user') self.selenium.switch_to.window('id_user')
self.wait_page_loaded() self.wait_page_loaded()
password_field = self.selenium.find_element_by_id('id_password') password_field = self.selenium.find_element_by_id('id_password')
password_field.send_keys('password') password_field.send_keys('password')
@ -1078,7 +1078,7 @@ class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
save_button_css_selector = '.submit-row > input[type=submit]' save_button_css_selector = '.submit-row > input[type=submit]'
self.selenium.find_element_by_css_selector(save_button_css_selector).click() self.selenium.find_element_by_css_selector(save_button_css_selector).click()
self.selenium.switch_to_window(main_window) self.selenium.switch_to.window(main_window)
# The field now contains the new user # The field now contains the new user
self.wait_for('#id_user option[value="newuser"]') self.wait_for('#id_user option[value="newuser"]')