@@ -1900,7 +1900,7 @@ def test_add_stackeds(self):
1900
1900
1901
1901
self .assertCountSeleniumElements (rows_selector , 3 )
1902
1902
add_button = self .selenium .find_element (
1903
- By .LINK_TEXT , "Add another Inner4 stacked"
1903
+ By .XPATH , "//button[contains(text(), ' Add another Inner4 stacked')] "
1904
1904
)
1905
1905
add_button .click ()
1906
1906
self .assertCountSeleniumElements (rows_selector , 4 )
@@ -1920,14 +1920,14 @@ def test_delete_stackeds(self):
1920
1920
self .assertCountSeleniumElements (rows_selector , 3 )
1921
1921
1922
1922
add_button = self .selenium .find_element (
1923
- By .LINK_TEXT , "Add another Inner4 stacked"
1923
+ By .XPATH , "//button[contains(text(), ' Add another Inner4 stacked')] "
1924
1924
)
1925
1925
add_button .click ()
1926
1926
add_button .click ()
1927
1927
1928
1928
self .assertCountSeleniumElements (rows_selector , 5 )
1929
1929
for delete_link in self .selenium .find_elements (
1930
- By .CSS_SELECTOR , "%s .inline-deletelink" % inline_id
1930
+ By .CSS_SELECTOR , "%s button .inline-deletelink" % inline_id
1931
1931
):
1932
1932
delete_link .click ()
1933
1933
with self .disable_implicit_wait ():
@@ -1948,8 +1948,7 @@ def test_delete_invalid_stacked_inlines(self):
1948
1948
self .assertCountSeleniumElements (rows_selector , 3 )
1949
1949
1950
1950
add_button = self .selenium .find_element (
1951
- By .LINK_TEXT ,
1952
- "Add another Inner4 stacked" ,
1951
+ By .XPATH , "//button[contains(text(), 'Add another Inner4 stacked')]"
1953
1952
)
1954
1953
add_button .click ()
1955
1954
add_button .click ()
@@ -1983,7 +1982,7 @@ def test_delete_invalid_stacked_inlines(self):
1983
1982
)
1984
1983
self .assertEqual ("Please correct the duplicate values below." , errorlist .text )
1985
1984
delete_link = self .selenium .find_element (
1986
- By .CSS_SELECTOR , "#inner4stacked_set-4 .inline-deletelink"
1985
+ By .CSS_SELECTOR , "#inner4stacked_set-4 button .inline-deletelink"
1987
1986
)
1988
1987
delete_link .click ()
1989
1988
self .assertCountSeleniumElements (rows_selector , 4 )
@@ -2014,7 +2013,7 @@ def test_delete_invalid_tabular_inlines(self):
2014
2013
self .assertCountSeleniumElements (rows_selector , 3 )
2015
2014
2016
2015
add_button = self .selenium .find_element (
2017
- By .LINK_TEXT , "Add another Inner4 tabular"
2016
+ By .XPATH , "//button[contains(text(), ' Add another Inner4 tabular')] "
2018
2017
)
2019
2018
add_button .click ()
2020
2019
add_button .click ()
@@ -2051,7 +2050,7 @@ def test_delete_invalid_tabular_inlines(self):
2051
2050
)
2052
2051
self .assertEqual ("Please correct the duplicate values below." , errorlist .text )
2053
2052
delete_link = self .selenium .find_element (
2054
- By .CSS_SELECTOR , "#inner4tabular_set-4 .inline-deletelink"
2053
+ By .CSS_SELECTOR , "#inner4tabular_set-4 button .inline-deletelink"
2055
2054
)
2056
2055
delete_link .click ()
2057
2056
@@ -2095,7 +2094,9 @@ def test_add_inlines(self):
2095
2094
)
2096
2095
2097
2096
# Add an inline
2098
- self .selenium .find_element (By .LINK_TEXT , "Add another Profile" ).click ()
2097
+ self .selenium .find_element (
2098
+ By .XPATH , "//button[contains(text(), 'Add another Profile')]"
2099
+ ).click ()
2099
2100
2100
2101
# The inline has been added, it has the right id, and it contains the
2101
2102
# correct fields.
@@ -2113,7 +2114,9 @@ def test_add_inlines(self):
2113
2114
".dynamic-profile_set#profile_set-1 input[name=profile_set-1-last_name]" , 1
2114
2115
)
2115
2116
# Let's add another one to be sure
2116
- self .selenium .find_element (By .LINK_TEXT , "Add another Profile" ).click ()
2117
+ self .selenium .find_element (
2118
+ By .XPATH , "//button[contains(text(), 'Add another Profile')]"
2119
+ ).click ()
2117
2120
self .assertCountSeleniumElements (".dynamic-profile_set" , 3 )
2118
2121
self .assertEqual (
2119
2122
self .selenium .find_elements (By .CSS_SELECTOR , ".dynamic-profile_set" )[
@@ -2189,10 +2192,18 @@ def test_delete_inlines(self):
2189
2192
)
2190
2193
2191
2194
# Add a few inlines
2192
- self .selenium .find_element (By .LINK_TEXT , "Add another Profile" ).click ()
2193
- self .selenium .find_element (By .LINK_TEXT , "Add another Profile" ).click ()
2194
- self .selenium .find_element (By .LINK_TEXT , "Add another Profile" ).click ()
2195
- self .selenium .find_element (By .LINK_TEXT , "Add another Profile" ).click ()
2195
+ self .selenium .find_element (
2196
+ By .XPATH , "//button[contains(text(), 'Add another Profile')]"
2197
+ ).click ()
2198
+ self .selenium .find_element (
2199
+ By .XPATH , "//button[contains(text(), 'Add another Profile')]"
2200
+ ).click ()
2201
+ self .selenium .find_element (
2202
+ By .XPATH , "//button[contains(text(), 'Add another Profile')]"
2203
+ ).click ()
2204
+ self .selenium .find_element (
2205
+ By .XPATH , "//button[contains(text(), 'Add another Profile')]"
2206
+ ).click ()
2196
2207
self .assertCountSeleniumElements (
2197
2208
"#profile_set-group table tr.dynamic-profile_set" , 5
2198
2209
)
@@ -2215,12 +2226,12 @@ def test_delete_inlines(self):
2215
2226
self .selenium .find_element (
2216
2227
By .CSS_SELECTOR ,
2217
2228
"form#profilecollection_form tr.dynamic-profile_set#profile_set-1 "
2218
- "td.delete a " ,
2229
+ "td.delete button " ,
2219
2230
).click ()
2220
2231
self .selenium .find_element (
2221
2232
By .CSS_SELECTOR ,
2222
2233
"form#profilecollection_form tr.dynamic-profile_set#profile_set-2 "
2223
- "td.delete a " ,
2234
+ "td.delete button " ,
2224
2235
).click ()
2225
2236
# The rows are gone and the IDs have been re-sequenced
2226
2237
self .assertCountSeleniumElements (
@@ -2273,7 +2284,9 @@ def test_added_stacked_inline_with_collapsed_fields(self):
2273
2284
self .live_server_url + reverse ("admin:admin_inlines_teacher_add" )
2274
2285
)
2275
2286
add_text = gettext ("Add another %(verbose_name)s" ) % {"verbose_name" : "Child" }
2276
- self .selenium .find_element (By .LINK_TEXT , add_text ).click ()
2287
+ self .selenium .find_element (
2288
+ By .XPATH , f"//button[contains(text(), '{ add_text } ')]"
2289
+ ).click ()
2277
2290
test_fields = ["#id_child_set-0-name" , "#id_child_set-1-name" ]
2278
2291
summaries = self .selenium .find_elements (By .TAG_NAME , "summary" )
2279
2292
self .assertEqual (len (summaries ), 3 )
@@ -2440,7 +2453,9 @@ def test_inlines_verbose_name(self):
2440
2453
self .assertIn ("Available attendant" , available .text )
2441
2454
self .assertIn ("Chosen attendant" , chosen .text )
2442
2455
# Added inline should also have the correct verbose_name.
2443
- self .selenium .find_element (By .LINK_TEXT , "Add another Class" ).click ()
2456
+ self .selenium .find_element (
2457
+ By .XPATH , "//button[contains(text(), 'Add another Class')]"
2458
+ ).click ()
2444
2459
available = self .selenium .find_element (
2445
2460
By .CSS_SELECTOR , css_available_selector % 1
2446
2461
)
@@ -2450,7 +2465,9 @@ def test_inlines_verbose_name(self):
2450
2465
self .assertIn ("Available attendant" , available .text )
2451
2466
self .assertIn ("Chosen attendant" , chosen .text )
2452
2467
# Third inline should also have the correct verbose_name.
2453
- self .selenium .find_element (By .LINK_TEXT , "Add another Class" ).click ()
2468
+ self .selenium .find_element (
2469
+ By .XPATH , "//button[contains(text(), 'Add another Class')]"
2470
+ ).click ()
2454
2471
available = self .selenium .find_element (
2455
2472
By .CSS_SELECTOR , css_available_selector % 2
2456
2473
)
@@ -2522,7 +2539,7 @@ def test_tabular_inline_delete_layout(self):
2522
2539
"fieldset.module tbody tr.dynamic-sighting_set:not(.original) td.delete" ,
2523
2540
)
2524
2541
self .assertIn (
2525
- '<a role ="button" class="inline-deletelink" href="# ">' ,
2542
+ '<button type ="button" class="inline-deletelink">' ,
2526
2543
delete .get_attribute ("innerHTML" ),
2527
2544
)
2528
2545
self .take_screenshot ("loaded" )
0 commit comments