diff --git a/dav_auth/tests/generic.py b/dav_auth/tests/generic.py index ace764a..eede63a 100644 --- a/dav_auth/tests/generic.py +++ b/dav_auth/tests/generic.py @@ -9,7 +9,7 @@ class SeleniumAuthMixin: username_field = self.wait_on_presence(driver, (By.ID, 'id_username')) username_field.clear() username_field.send_keys(username) - password_field = driver.find_element_by_id('id_password') + password_field = driver.find_element(By.ID, 'id_password') password_field.clear() password_field.send_keys(password) password_field.send_keys(Keys.RETURN) diff --git a/dav_auth/tests/test_screenshots.py b/dav_auth/tests/test_screenshots.py index 168476a..9d30265 100644 --- a/dav_auth/tests/test_screenshots.py +++ b/dav_auth/tests/test_screenshots.py @@ -31,25 +31,25 @@ class TestCase(ScreenshotTestCase): # Go to login page via login button on root page -> save plain login form c = self.selenium c.get(self.complete_url('/')) - link = c.find_element_by_css_selector('#login-widget a') + link = c.find_element(By.CSS_SELECTOR, '#login-widget a') link.click() self.wait_on_presence(c, (By.ID, 'id_username')) self.save_screenshot('empty_login_form', sequence=sequence_name) # Fill in a password -> Save dots in password field - username_field = c.find_element_by_id('id_username') + username_field = c.find_element(By.ID, 'id_username') username_field.clear() username_field.send_keys('username') - password_field = c.find_element_by_id('id_password') + password_field = c.find_element(By.ID, 'id_password') password_field.clear() password_field.send_keys(self.test_password) self.save_screenshot('filled_login_form', sequence=sequence_name) # Wrong username -> save error message - username_field = c.find_element_by_id('id_username') + username_field = c.find_element(By.ID, 'id_username') username_field.clear() username_field.send_keys(self.test_username[::-1]) - password_field = c.find_element_by_id('id_password') + password_field = c.find_element(By.ID, 'id_password') password_field.clear() password_field.send_keys(self.test_password) password_field.send_keys(Keys.RETURN) @@ -58,10 +58,10 @@ class TestCase(ScreenshotTestCase): alert_button.click() # Wrong password -> save error message - username_field = c.find_element_by_id('id_username') + username_field = c.find_element(By.ID, 'id_username') username_field.clear() username_field.send_keys(self.test_username) - password_field = c.find_element_by_id('id_password') + password_field = c.find_element(By.ID, 'id_password') password_field.clear() password_field.send_keys(self.test_password[::-1]) password_field.send_keys(Keys.RETURN) @@ -72,10 +72,10 @@ class TestCase(ScreenshotTestCase): # Login of inactive user -> save error message self.user.is_active = False self.user.save() - username_field = c.find_element_by_id('id_username') + username_field = c.find_element(By.ID, 'id_username') username_field.clear() username_field.send_keys(self.test_username) - password_field = c.find_element_by_id('id_password') + password_field = c.find_element(By.ID, 'id_password') password_field.clear() password_field.send_keys(self.test_password) password_field.send_keys(Keys.RETURN) @@ -87,10 +87,10 @@ class TestCase(ScreenshotTestCase): self.user.save() # Login -> save success message - username_field = c.find_element_by_id('id_username') + username_field = c.find_element(By.ID, 'id_username') username_field.clear() username_field.send_keys(self.test_username) - password_field = c.find_element_by_id('id_password') + password_field = c.find_element(By.ID, 'id_password') password_field.clear() password_field.send_keys(self.test_password) password_field.send_keys(Keys.RETURN) @@ -104,18 +104,18 @@ class TestCase(ScreenshotTestCase): self.save_screenshot('user_menu', sequence=sequence_name) # Click on 'set password' -> save set password page - user_menu = c.find_element_by_css_selector('#login-widget ul') - link = user_menu.find_element_by_partial_link_text(ugettext('Passwort ändern')) + user_menu = c.find_element(By.CSS_SELECTOR, '#login-widget ul') + link = user_menu.find_element(By.PARTIAL_LINK_TEXT, ugettext('Passwort ändern')) link.click() password_field = self.wait_on_presence(c, (By.ID, 'id_new_password')) self.save_screenshot('empty_set_password_form', sequence=sequence_name) # Fill in a password -> Save dots in password field - send_mail_field = c.find_element_by_id('id_send_password_mail') + send_mail_field = c.find_element(By.ID, 'id_send_password_mail') send_mail_field.click() password_field.clear() password_field.send_keys(self.test_password) - password2_field = c.find_element_by_id('id_new_password_repeat') + password2_field = c.find_element(By.ID, 'id_new_password_repeat') password2_field.clear() password2_field.send_keys(self.test_password) self.save_screenshot('filled_set_password_form', sequence=sequence_name) @@ -131,10 +131,10 @@ class TestCase(ScreenshotTestCase): # New passwords too common and too short -> save error message password = 'abcdef' - password_field = c.find_element_by_id('id_new_password') + password_field = c.find_element(By.ID, 'id_new_password') password_field.clear() password_field.send_keys(password) - password2_field = c.find_element_by_id('id_new_password_repeat') + password2_field = c.find_element(By.ID, 'id_new_password_repeat') password2_field.clear() password2_field.send_keys(password) password2_field.send_keys(Keys.RETURN) @@ -143,10 +143,10 @@ class TestCase(ScreenshotTestCase): # New passwords entirely_numeric -> save error message password = '9126735804' - password_field = c.find_element_by_id('id_new_password') + password_field = c.find_element(By.ID, 'id_new_password') password_field.clear() password_field.send_keys(password) - password2_field = c.find_element_by_id('id_new_password_repeat') + password2_field = c.find_element(By.ID, 'id_new_password_repeat') password2_field.clear() password2_field.send_keys(password) password2_field.send_keys(Keys.RETURN) @@ -155,10 +155,10 @@ class TestCase(ScreenshotTestCase): # New passwords too similar -> save error message password = self.test_username - password_field = c.find_element_by_id('id_new_password') + password_field = c.find_element(By.ID, 'id_new_password') password_field.clear() password_field.send_keys(password) - password2_field = c.find_element_by_id('id_new_password_repeat') + password2_field = c.find_element(By.ID, 'id_new_password_repeat') password2_field.clear() password2_field.send_keys(password) password2_field.send_keys(Keys.RETURN) @@ -167,10 +167,10 @@ class TestCase(ScreenshotTestCase): # Change password -> save success message password = self.test_password[::-1] - password_field = c.find_element_by_id('id_new_password') + password_field = c.find_element(By.ID, 'id_new_password') password_field.clear() password_field.send_keys(password) - password2_field = c.find_element_by_id('id_new_password_repeat') + password2_field = c.find_element(By.ID, 'id_new_password_repeat') password2_field.clear() password2_field.send_keys(password) password2_field.send_keys(Keys.RETURN) @@ -179,7 +179,7 @@ class TestCase(ScreenshotTestCase): # Get password recreate page -> since we are logged in, it should # redirect to set password page again -> save - html = c.find_element_by_tag_name('html') + html = c.find_element(By.TAG_NAME, 'html') c.get(self.complete_url(reverse('dav_auth:recreate_password'))) self.wait_until_stale(c, html) self.wait_on_presence(c, (By.ID, 'id_new_password')) @@ -188,19 +188,19 @@ class TestCase(ScreenshotTestCase): # Click on 'logout' -> save page dropdown_button = self.wait_on_presence(c, (By.ID, 'user_dropdown_button')) dropdown_button.click() - user_menu = c.find_element_by_css_selector('#login-widget ul') - link = user_menu.find_element_by_partial_link_text(ugettext('Logout')) + user_menu = c.find_element(By.CSS_SELECTOR, '#login-widget ul') + link = user_menu.find_element(By.PARTIAL_LINK_TEXT, ugettext('Logout')) link.click() self.wait_until_stale(c, user_menu) self.save_screenshot('logout_succeed', sequence=sequence_name) # Click on 'login' to access password recreate link - link = c.find_element_by_css_selector('#login-widget a') + link = c.find_element(By.CSS_SELECTOR, '#login-widget a') link.click() self.wait_on_presence(c, (By.ID, 'id_username')) # Locate password recreate link, click it -> save password recreate form - link = c.find_element_by_partial_link_text(ugettext('Passwort vergessen')) + link = c.find_element(By.PARTIAL_LINK_TEXT, ugettext('Passwort vergessen')) link.click() username_field = self.wait_on_presence(c, (By.ID, 'id_username')) self.save_screenshot('empty_recreate_password_form', sequence=sequence_name) @@ -212,7 +212,7 @@ class TestCase(ScreenshotTestCase): self.save_screenshot('recreate_password_invalid_user', sequence=sequence_name) # Locate password recreate link, click it - link = c.find_element_by_partial_link_text(ugettext('Passwort vergessen')) + link = c.find_element(By.PARTIAL_LINK_TEXT, ugettext('Passwort vergessen')) link.click() username_field = self.wait_on_presence(c, (By.ID, 'id_username')) diff --git a/dav_auth/tests/test_templates.py b/dav_auth/tests/test_templates.py index 211d7c0..b33ca12 100644 --- a/dav_auth/tests/test_templates.py +++ b/dav_auth/tests/test_templates.py @@ -40,7 +40,7 @@ class TestCase(SeleniumAuthMixin, SeleniumTestCase): c = self.selenium c.get(self.complete_url('/')) try: - c.find_element_by_css_selector('#login-widget a') + c.find_element(By.CSS_SELECTOR, '#login-widget a') except NoSuchElementException as e: # pragma: no cover self.fail(str(e)) @@ -50,9 +50,9 @@ class TestCase(SeleniumAuthMixin, SeleniumTestCase): location = reverse('dav_auth:login') c.get(self.complete_url(location)) - field = c.find_element_by_id('id_username') + field = c.find_element(By.ID, 'id_username') self.assertEqual(field.get_attribute('required'), 'true') - field = c.find_element_by_id('id_password') + field = c.find_element(By.ID, 'id_password') self.assertEqual(field.get_attribute('required'), 'true') def test_required_fields_in_set_password_form(self): @@ -61,7 +61,7 @@ class TestCase(SeleniumAuthMixin, SeleniumTestCase): c.get(self.complete_url(reverse('dav_auth:set_password'))) field = self.wait_on_presence(c, (By.ID, 'id_new_password')) self.assertEqual(field.get_attribute('required'), 'true') - field = c.find_element_by_id('id_new_password_repeat') + field = c.find_element(By.ID, 'id_new_password_repeat') self.assertEqual(field.get_attribute('required'), 'true') - field = c.find_element_by_id('id_send_password_mail') + field = c.find_element(By.ID, 'id_send_password_mail') self.assertEqual(field.get_attribute('required'), None) diff --git a/dav_events/tests/test_screenshots.py b/dav_events/tests/test_screenshots.py index 78de5aa..40d7668 100644 --- a/dav_events/tests/test_screenshots.py +++ b/dav_events/tests/test_screenshots.py @@ -135,30 +135,30 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): self.save_screenshot('mode_form', sequence=sequence_name) if 'mode' in data: - field = c.find_element_by_id('id_mode') - radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['mode'])) + field = c.find_element(By.ID, 'id_mode') + radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['mode'])) radio.click() if 'sport' in data: - field = c.find_element_by_id('id_sport') - radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['sport'])) + field = c.find_element(By.ID, 'id_sport') + radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['sport'])) radio.click() if 'level' in data: - field = c.find_element_by_id('id_level') - radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['level'])) + field = c.find_element(By.ID, 'id_level') + radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['level'])) radio.click() if 'ski_lift' in data and data['ski_lift']: - field = c.find_element_by_id('id_ski_lift') + field = c.find_element(By.ID, 'id_ski_lift') field.click() - field = c.find_element_by_css_selector('input#id_first_day_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_first_day_widget') field.send_keys(data['first_day']) - td = c.find_element_by_css_selector('div.datetimepicker-days td.active') + td = c.find_element(By.CSS_SELECTOR, 'div.datetimepicker-days td.active') td.click() - field = c.find_element_by_css_selector('input#id_last_day_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_last_day_widget') field.click() if screenshots: self.save_screenshot('last_date_widget', sequence=sequence_name) @@ -166,74 +166,74 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): field.send_keys(data['last_day']) if 'alt_first_day' in data: - field = c.find_element_by_css_selector('input#id_alt_first_day_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_alt_first_day_widget') field.send_keys(data['alt_first_day']) if 'alt_last_day' in data: - field = c.find_element_by_css_selector('input#id_alt_last_day_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_alt_last_day_widget') field.send_keys(data['alt_last_day']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('location_form', sequence=sequence_name) if 'country' in data: - field = c.find_element_by_id('id_country') + field = c.find_element(By.ID, 'id_country') Select(field).select_by_value(data['country']) if 'terrain' in data: - field = c.find_element_by_id('id_terrain') + field = c.find_element(By.ID, 'id_terrain') Select(field).select_by_value(data['terrain']) if 'location' in data: - field = c.find_element_by_id('id_location') + field = c.find_element(By.ID, 'id_location') field.send_keys(data['location']) if 'transport_other' in data: - field = c.find_element_by_id('id_transport_other') + field = c.find_element(By.ID, 'id_transport_other') field.send_keys(data['transport_other']) if 'transport' in data: - field = c.find_element_by_id('id_transport') + field = c.find_element(By.ID, 'id_transport') Select(field).select_by_value(data['transport']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('journey_form', sequence=sequence_name) if 'meeting_point_other' in data: - field = c.find_element_by_id('id_meeting_point_other') + field = c.find_element(By.ID, 'id_meeting_point_other') field.send_keys(data['meeting_point_other']) if 'meeting_point' in data: - field = c.find_element_by_id('id_meeting_point') + field = c.find_element(By.ID, 'id_meeting_point') Select(field).select_by_value(data['meeting_point']) if 'meeting_time' in data: - field = c.find_element_by_css_selector('input#id_meeting_time_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_meeting_time_widget') field.send_keys(data['meeting_time']) if 'departure_time' in data: - field = c.find_element_by_css_selector('input#id_departure_time_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_departure_time_widget') field.send_keys(data['departure_time']) if 'departure_ride' in data: - field = c.find_element_by_id('id_departure_ride') + field = c.find_element(By.ID, 'id_departure_ride') field.send_keys(data['departure_ride']) if 'return_departure_time' in data: - field = c.find_element_by_css_selector('input#id_return_departure_time_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_return_departure_time_widget') field.send_keys(data['return_departure_time']) if 'return_arrival_time' in data: - field = c.find_element_by_css_selector('input#id_return_arrival_time_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_return_arrival_time_widget') field.send_keys(data['return_arrival_time']) if 'arrival_previous_day' in data and data['arrival_previous_day']: - field = c.find_element_by_id('id_arrival_previous_day') + field = c.find_element(By.ID, 'id_arrival_previous_day') field.click() - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) @@ -242,18 +242,18 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): self.save_screenshot('accommodation_form', sequence=sequence_name) if 'basecamp' in data: - field = c.find_element_by_id('id_basecamp') + field = c.find_element(By.ID, 'id_basecamp') field.send_keys(data['basecamp']) if 'accommodation' in data: - field = c.find_element_by_id('id_accommodation') + field = c.find_element(By.ID, 'id_accommodation') Select(field).select_by_value(data['accommodation']) if 'meals_other' in data: - field = c.find_element_by_id('id_meals_other') + field = c.find_element(By.ID, 'id_meals_other') field.send_keys(data['meals_other']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) @@ -261,7 +261,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): self.save_screenshot('requirements_form', sequence=sequence_name) if 'requirements_add' in data: - field = c.find_element_by_id('id_requirements') + field = c.find_element(By.ID, 'id_requirements') field.send_keys(Keys.RETURN) if isinstance(data['requirements_add'], list): field.send_keys(Keys.RETURN.join(data['requirements_add'])) @@ -269,14 +269,14 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): field.send_keys(data['requirements_add']) if 'pre_meeting_1' in data: - field = c.find_element_by_css_selector('input#id_pre_meeting_1_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_pre_meeting_1_widget') field.send_keys(data['pre_meeting_1']) if 'pre_meeting_2' in data: - field = c.find_element_by_css_selector('input#id_pre_meeting_2_widget') + field = c.find_element(By.CSS_SELECTOR, 'input#id_pre_meeting_2_widget') field.send_keys(data['pre_meeting_2']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) if screenshots: @@ -289,60 +289,60 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): field.send_keys(data['trainer_firstname']) if 'trainer_familyname' in data: - field = c.find_element_by_id('id_trainer_familyname') + field = c.find_element(By.ID, 'id_trainer_familyname') if auth: field.clear() field.send_keys(data['trainer_familyname']) if 'trainer_email' in data: - field = c.find_element_by_id('id_trainer_email') + field = c.find_element(By.ID, 'id_trainer_email') if auth: field.clear() field.send_keys(data['trainer_email']) if 'trainer_phone' in data: - field = c.find_element_by_id('id_trainer_phone') + field = c.find_element(By.ID, 'id_trainer_phone') if auth: field.clear() field.send_keys(data['trainer_phone']) if 'trainer_2_fullname' in data: - field = c.find_element_by_id('id_trainer_2_fullname') + field = c.find_element(By.ID, 'id_trainer_2_fullname') field.send_keys(data['trainer_2_fullname']) if 'trainer_3_fullname' in data: - field = c.find_element_by_id('id_trainer_3_fullname') + field = c.find_element(By.ID, 'id_trainer_3_fullname') field.send_keys(data['trainer_3_fullname']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('registration_form', sequence=sequence_name) if 'deadline' in data: - field = c.find_element_by_id('id_deadline') - radio = field.find_element_by_css_selector('input[value=\'{}\']'.format(data['deadline'])) + field = c.find_element(By.ID, 'id_deadline') + radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'{}\']'.format(data['deadline'])) radio.click() - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('charges_form', sequence=sequence_name) if 'charge' in data: - field = c.find_element_by_id('id_charge') + field = c.find_element(By.ID, 'id_charge') field.clear() field.send_keys(data['charge']) if 'additional_costs' in data: - field = c.find_element_by_id('id_additional_costs') + field = c.find_element(By.ID, 'id_additional_costs') field.clear() if data['additional_costs'] is not None: field.send_keys(data['additional_costs']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) @@ -350,49 +350,49 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): if screenshots: self.save_screenshot('training_form', sequence=sequence_name) - field = c.find_element_by_id('id_course_topic_1') + field = c.find_element(By.ID, 'id_course_topic_1') if isinstance(data['course_topic_1'], list): field.send_keys(Keys.RETURN.join(data['course_topic_1'])) else: field.send_keys(data['course_topic_1']) if 'course_topic_2' in data: - field = c.find_element_by_id('id_course_topic_2') + field = c.find_element(By.ID, 'id_course_topic_2') field.send_keys(data['course_topic_2']) if 'course_topic_3' in data: - button = c.find_element_by_id('btn-topic-add') + button = c.find_element(By.ID, 'btn-topic-add') button.click() - field = c.find_element_by_id('id_course_topic_3') + field = c.find_element(By.ID, 'id_course_topic_3') field.send_keys(data['course_topic_3']) if 'course_topic_4' in data: button.click() - field = c.find_element_by_id('id_course_topic_4') + field = c.find_element(By.ID, 'id_course_topic_4') field.send_keys(data['course_topic_4']) - field = c.find_element_by_id('id_course_goal_1') + field = c.find_element(By.ID, 'id_course_goal_1') if isinstance(data['course_goal_1'], list): field.send_keys(Keys.RETURN.join(data['course_goal_1'])) else: field.send_keys(data['course_goal_1']) if 'course_goal_2' in data: - field = c.find_element_by_id('id_course_goal_2') + field = c.find_element(By.ID, 'id_course_goal_2') field.send_keys(data['course_goal_2']) if 'course_goal_3' in data: - button = c.find_element_by_id('btn-goal-add') + button = c.find_element(By.ID, 'btn-goal-add') button.click() - field = c.find_element_by_id('id_course_goal_3') + field = c.find_element(By.ID, 'id_course_goal_3') field.send_keys(data['course_goal_3']) if 'course_goal_4' in data: button.click() - field = c.find_element_by_id('id_course_goal_4') + field = c.find_element(By.ID, 'id_course_goal_4') field.send_keys(data['course_goal_4']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) @@ -400,29 +400,29 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): self.save_screenshot('description_form', sequence=sequence_name) if 'title' in data: - field = c.find_element_by_id('id_title') + field = c.find_element(By.ID, 'id_title') field.clear() field.send_keys(data['title']) - field = c.find_element_by_id('id_description') + field = c.find_element(By.ID, 'id_description') if isinstance(data['description'], list): field.send_keys(Keys.RETURN.join(data['description'])) else: field.send_keys(data['description']) - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('summary_form', sequence=sequence_name) - button = c.find_element_by_id('btn-form-back') + button = c.find_element(By.ID, 'btn-form-back') button.click() self.wait_until_stale(c, button) for i in range(0, 11): try: - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') button.click() self.wait_until_stale(c, button) except NoSuchElementException: @@ -431,13 +431,13 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): self.fail('Too many sub forms') if 'internal_note' in data: - field = c.find_element_by_id('id_internal_note') + field = c.find_element(By.ID, 'id_internal_note') if isinstance(data['internal_note'], list): field.send_keys(Keys.RETURN.join(data['internal_note'])) else: field.send_keys(data['internal_note']) - button = c.find_element_by_id('btn-form-submit') + button = c.find_element(By.ID, 'btn-form-submit') button.click() self.wait_until_stale(c, button) @@ -445,9 +445,9 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): if screenshots: self.save_screenshot('user_and_event_created_set_password', sequence=sequence_name) - field = c.find_element_by_id('id_new_password') + field = c.find_element(By.ID, 'id_new_password') field.send_keys(TEST_PASSWORD) - field = c.find_element_by_id('id_new_password_repeat') + field = c.find_element(By.ID, 'id_new_password_repeat') field.send_keys(TEST_PASSWORD) field.send_keys(Keys.RETURN) @@ -471,20 +471,20 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): if screenshots: self.save_screenshot('event_list_before', sequence=sequence_name) - link = c.find_element_by_link_text(title) + link = c.find_element(By.LINK_TEXT, title) link.click() self.wait_until_stale(c, link) if screenshots: self.save_screenshot('event_details', sequence=sequence_name) - button = c.find_element_by_id('btn-clone') + button = c.find_element(By.ID, 'btn-clone') button.click() self.wait_until_stale(c, button) for i in range(0, 11): try: - button = c.find_element_by_id('btn-form-next') + button = c.find_element(By.ID, 'btn-form-next') except NoSuchElementException: break @@ -492,8 +492,8 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): self.save_screenshot('form', sequence=sequence_name) try: - field = c.find_element_by_id('id_deadline') - radio = field.find_element_by_css_selector('input[value=\'OTHER\']') + field = c.find_element(By.ID, 'id_deadline') + radio = field.find_element(By.CSS_SELECTOR, 'input[value=\'OTHER\']') radio.click() except NoSuchElementException: pass @@ -506,7 +506,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): if screenshots: self.save_screenshot('summary', sequence=sequence_name) - button = c.find_element_by_id('btn-form-submit') + button = c.find_element(By.ID, 'btn-form-submit') button.click() self.wait_until_stale(c, button) @@ -523,28 +523,28 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): button.click() self.wait_until_stale(c, button) - link = c.find_element_by_link_text(title) + link = c.find_element(By.LINK_TEXT, title) link.click() self.wait_until_stale(c, link) - action_tabs = c.find_element_by_css_selector('.action-tabs > ul.nav-tabs') - tab = action_tabs.find_element_by_link_text(ugettext(u'Ändern')) + action_tabs = c.find_element(By.CSS_SELECTOR, '.action-tabs > ul.nav-tabs') + tab = action_tabs.find_element(By.LINK_TEXT, ugettext(u'Ändern')) tab.click() self.wait_until_stale(c, tab) - panels = c.find_elements_by_css_selector('#form-accordion .panel-collapse') + panels = c.find_elements(By.CSS_SELECTOR, '#form-accordion .panel-collapse') for panel in panels[:-1]: if screenshots: self.save_screenshot('edit-form', sequence=sequence_name) - button = panel.find_element_by_partial_link_text(ugettext(u'Nächster Abschnitt')) + button = panel.find_element(By.PARTIAL_LINK_TEXT, ugettext(u'Nächster Abschnitt')) button.click() time.sleep(.5) if screenshots: self.save_screenshot('edit-form', sequence=sequence_name) - button = c.find_element_by_css_selector('form button[type="submit"]') + button = c.find_element(By.CSS_SELECTOR, 'form button[type="submit"]') button.click() self.wait_until_stale(c, button) @@ -561,26 +561,26 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): if screenshots: self.save_screenshot('event_list_before', sequence=sequence_name) - link = c.find_element_by_link_text(title) + link = c.find_element(By.LINK_TEXT, title) link.click() self.wait_until_stale(c, link) if screenshots: self.save_screenshot('event_details', sequence=sequence_name) - button = c.find_element_by_id('btn-accept') + button = c.find_element(By.ID, 'btn-accept') button.click() time.sleep(.5) if screenshots: self.save_screenshot('accept_modal', sequence=sequence_name) - button = c.find_element_by_css_selector('#modal-accept-dialog a.btn-success') + button = c.find_element(By.CSS_SELECTOR, '#modal-accept-dialog a.btn-success') button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('accepted', sequence=sequence_name) - link = c.find_element_by_link_text(ugettext('Veranstaltungsliste')) + link = c.find_element(By.LINK_TEXT, ugettext('Veranstaltungsliste')) link.click() self.wait_until_stale(c, link) if screenshots: @@ -599,26 +599,26 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): if screenshots: self.save_screenshot('event_list_before', sequence=sequence_name) - link = c.find_element_by_link_text(title) + link = c.find_element(By.LINK_TEXT, title) link.click() self.wait_until_stale(c, link) if screenshots: self.save_screenshot('event_details', sequence=sequence_name) - button = c.find_element_by_id('btn-confirmpublication') + button = c.find_element(By.ID, 'btn-confirmpublication') button.click() time.sleep(.5) if screenshots: self.save_screenshot('confirmpublication_modal', sequence=sequence_name) - button = c.find_element_by_css_selector('#btn-confirmpublication-{}'.format(channel)) + button = c.find_element(By.CSS_SELECTOR, '#btn-confirmpublication-{}'.format(channel)) button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('confirmed_{}'.format(channel), sequence=sequence_name) - link = c.find_element_by_link_text(ugettext('Veranstaltungsliste')) + link = c.find_element(By.LINK_TEXT, ugettext('Veranstaltungsliste')) link.click() self.wait_until_stale(c, link) if screenshots: @@ -637,20 +637,20 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): if screenshots: self.save_screenshot('event_list_before', sequence=sequence_name) - link = c.find_element_by_link_text(title) + link = c.find_element(By.LINK_TEXT, title) link.click() self.wait_until_stale(c, link) if screenshots: self.save_screenshot('event_details', sequence=sequence_name) - button = c.find_element_by_id('btn-confirmclearance') + button = c.find_element(By.ID, 'btn-confirmclearance') button.click() self.wait_until_stale(c, button) if screenshots: self.save_screenshot('confirmed_clearance', sequence=sequence_name) - link = c.find_element_by_link_text(ugettext('Veranstaltungsliste')) + link = c.find_element(By.LINK_TEXT, ugettext('Veranstaltungsliste')) link.click() self.wait_until_stale(c, link) if screenshots: @@ -688,7 +688,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): self.create_event(TEST_EVENT_DATA_W, auth=True) self.create_event(TEST_EVENT_DATA_M, auth=True) - link = c.find_element_by_link_text(TEST_EVENT_DATA_W['title']) + link = c.find_element(By.LINK_TEXT, TEST_EVENT_DATA_W['title']) link.click() self.wait_until_stale(c, link) self.save_screenshot('owner_event_details') @@ -730,7 +730,7 @@ class TestCase(SeleniumAuthMixin, RoleMixin, ScreenshotTestCase): button.click() self.wait_until_stale(c, button) - link = c.find_element_by_partial_link_text(ugettext(u'Veranstaltungsliste herunterladen')) + link = c.find_element(By.PARTIAL_LINK_TEXT, ugettext(u'Veranstaltungsliste herunterladen')) link.click() self.wait_until_stale(c, link) self.save_screenshot('event_export_form')