@@ -30,7 +30,7 @@ def _fill_in_author_form(form_elt, name, email, affiliation, country):
3030 # To enter the person, type their name in the select2 search box, wait for the
3131 # search to offer the result, then press 'enter' to accept the result and close
3232 # the search input.
33- person_span = form_elt .find_element_by_class_name ( 'select2-chosen' )
33+ person_span = form_elt .find_element ( By . CLASS_NAME , 'select2-chosen' )
3434 self .scroll_to_element (person_span )
3535 person_span .click ()
3636 input = self .driver .switch_to .active_element
@@ -46,27 +46,27 @@ def _fill_in_author_form(form_elt, name, email, affiliation, country):
4646 # After the author is selected, the email select options will be populated.
4747 # Wait for that, then click on the option corresponding to the requested email.
4848 # This will only work if the email matches an address for the selected person.
49- email_select = form_elt .find_element_by_css_selector ( 'select[name$="email"]' )
49+ email_select = form_elt .find_element ( By . CSS_SELECTOR , 'select[name$="email"]' )
5050 email_option = self .wait .until (
5151 presence_of_element_child_by_css_selector (email_select , 'option[value="{}"]' .format (email ))
5252 )
5353 email_option .click () # select the email
5454
5555 # Fill in the affiliation and country. Finally, simple text inputs!
56- affil_input = form_elt .find_element_by_css_selector ( 'input[name$="affiliation"]' )
56+ affil_input = form_elt .find_element ( By . CSS_SELECTOR , 'input[name$="affiliation"]' )
5757 affil_input .send_keys (affiliation )
58- country_input = form_elt .find_element_by_css_selector ( 'input[name$="country"]' )
58+ country_input = form_elt .find_element ( By . CSS_SELECTOR , 'input[name$="country"]' )
5959 country_input .send_keys (country )
6060
6161 def _read_author_form (form_elt ):
6262 """Read values from an author form
6363
6464 Note: returns the Person instance named in the person field, not just their name.
6565 """
66- hidden_person_input = form_elt .find_element_by_css_selector ( 'input[type="text"][name$="person"]' )
67- email_select = form_elt .find_element_by_css_selector ( 'select[name$="email"]' )
68- affil_input = form_elt .find_element_by_css_selector ( 'input[name$="affiliation"]' )
69- country_input = form_elt .find_element_by_css_selector ( 'input[name$="country"]' )
66+ hidden_person_input = form_elt .find_element ( By . CSS_SELECTOR , 'input[type="text"][name$="person"]' )
67+ email_select = form_elt .find_element ( By . CSS_SELECTOR , 'select[name$="email"]' )
68+ affil_input = form_elt .find_element ( By . CSS_SELECTOR , 'input[name$="affiliation"]' )
69+ country_input = form_elt .find_element ( By . CSS_SELECTOR , 'input[name$="country"]' )
7070 return (
7171 Person .objects .get (pk = hidden_person_input .get_attribute ('value' )),
7272 email_select .get_attribute ('value' ),
@@ -87,16 +87,16 @@ def _read_author_form(form_elt):
8787 self .driver .get (url )
8888
8989 # The draft has one author to start with. Find the list and check the count.
90- authors_list = self .driver .find_element_by_id ( 'authors-list' )
91- author_forms = authors_list .find_elements_by_class_name ( 'author-panel' )
90+ authors_list = self .driver .find_element ( By . ID , 'authors-list' )
91+ author_forms = authors_list .find_elements ( By . CLASS_NAME , 'author-panel' )
9292 self .assertEqual (len (author_forms ), 1 )
9393
9494 # get the "add author" button so we can add blank author forms
95- add_author_button = self .driver .find_element_by_id ( 'add-author-button' )
95+ add_author_button = self .driver .find_element ( By . ID , 'add-author-button' )
9696 for index , auth in enumerate (authors ):
9797 self .scroll_to_element (add_author_button ) # Can only click if it's in view!
9898 add_author_button .click () # Create a new form. Automatically scrolls to it.
99- author_forms = authors_list .find_elements_by_class_name ( 'author-panel' )
99+ author_forms = authors_list .find_elements ( By . CLASS_NAME , 'author-panel' )
100100 authors_added = index + 1
101101 self .assertEqual (len (author_forms ), authors_added + 1 ) # Started with 1 author, hence +1
102102 _fill_in_author_form (author_forms [index + 1 ], auth .name , str (auth .email ()), orgs [index ], countries [index ])
@@ -114,9 +114,9 @@ def _read_author_form(form_elt):
114114 )
115115
116116 # Must provide a "basis" (change reason)
117- self .driver .find_element_by_id ( 'id_basis' ).send_keys ('change testing' )
117+ self .driver .find_element ( By . ID , 'id_basis' ).send_keys ('change testing' )
118118 # Now click the 'submit' button and check that the update was accepted.
119- submit_button = self .driver .find_element_by_css_selector ( 'button[type="submit"]' )
119+ submit_button = self .driver .find_element ( By . CSS_SELECTOR , 'button[type="submit"]' )
120120 self .scroll_to_element (submit_button )
121121 submit_button .click ()
122122 # Wait for redirect to the document_main view
0 commit comments