Skip to content

Commit f6b1978

Browse files
committed
lists are counted with len()
1 parent 844ed3f commit f6b1978

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

py/test/selenium/webdriver/support/relative_by_tests.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ def test_should_be_able_to_combine_filters(driver, pages):
6464
pages.load("relative_locators.html")
6565

6666
elements = driver.find_elements(
67-
with_tag_name("td")
68-
.above(driver.find_element(By.ID, "center"))
69-
.to_right_of(driver.find_element(By.ID, "top"))
67+
with_tag_name("td").above(driver.find_element(By.ID, "center")).to_right_of(driver.find_element(By.ID, "top"))
7068
)
7169

7270
ids = [el.get_attribute("id") for el in elements]
@@ -76,9 +74,7 @@ def test_should_be_able_to_combine_filters(driver, pages):
7674
def test_should_be_able_to_combine_filters_by_locator(driver, pages):
7775
pages.load("relative_locators.html")
7876

79-
elements = driver.find_elements(
80-
with_tag_name("td").above({By.ID: "center"}).to_right_of({By.ID: "top"})
81-
)
77+
elements = driver.find_elements(with_tag_name("td").above({By.ID: "center"}).to_right_of({By.ID: "top"}))
8278

8379
ids = [el.get_attribute("id") for el in elements]
8480
assert "topRight" in ids
@@ -142,7 +138,7 @@ def test_should_be_able_to_combine_straight_filters(driver, pages):
142138
)
143139

144140
ids = [el.get_attribute("id") for el in elements]
145-
assert ids.count() == 1
141+
assert len(ids) == 1
146142
assert "bottomRight" in ids
147143

148144

@@ -220,7 +216,7 @@ def test_should_find_elements_above_another(driver, pages):
220216
elements = driver.find_elements(with_tag_name("td").above({By.ID: "center"}))
221217

222218
ids = [el.get_attribute("id") for el in elements]
223-
assert ids.count() == 3
219+
assert len(ids) == 3
224220
assert "top" in ids
225221
assert "topLeft" in ids
226222
assert "topRight" in ids
@@ -232,7 +228,7 @@ def test_should_find_elements_below_another(driver, pages):
232228
elements = driver.find_elements(with_tag_name("td").below({By.ID: "center"}))
233229

234230
ids = [el.get_attribute("id") for el in elements]
235-
assert ids.count() == 3
231+
assert len(ids) == 3
236232
assert "bottom" in ids
237233
assert "bottomLeft" in ids
238234
assert "bottomRight" in ids
@@ -244,7 +240,7 @@ def test_should_find_elements_left_of_another(driver, pages):
244240
elements = driver.find_elements(with_tag_name("td").to_left_of({By.ID: "center"}))
245241

246242
ids = [el.get_attribute("id") for el in elements]
247-
assert ids.count() == 3
243+
assert len(ids) == 3
248244
assert "left" in ids
249245
assert "topLeft" in ids
250246
assert "bottomLeft" in ids
@@ -256,7 +252,7 @@ def test_should_find_elements_right_of_another(driver, pages):
256252
elements = driver.find_elements(with_tag_name("td").to_right_of({By.ID: "center"}))
257253

258254
ids = [el.get_attribute("id") for el in elements]
259-
assert ids.count() == 3
255+
assert len(ids) == 3
260256
assert "right" in ids
261257
assert "topRight" in ids
262258
assert "bottomRight" in ids
@@ -268,7 +264,7 @@ def test_should_find_elements_straight_above_another(driver, pages):
268264
elements = driver.find_elements(with_tag_name("td").above({By.ID: "bottom"}))
269265

270266
ids = [el.get_attribute("id") for el in elements]
271-
assert ids.count() == 2
267+
assert len(ids) == 2
272268
assert "top" in ids
273269
assert "center" in ids
274270

@@ -279,7 +275,7 @@ def test_should_find_elements_straight_below_another(driver, pages):
279275
elements = driver.find_elements(with_tag_name("td").below({By.ID: "top"}))
280276

281277
ids = [el.get_attribute("id") for el in elements]
282-
assert ids.count() == 2
278+
assert len(ids) == 2
283279
assert "bottom" in ids
284280
assert "center" in ids
285281

@@ -290,7 +286,7 @@ def test_should_find_elements_straight_left_of_another(driver, pages):
290286
elements = driver.find_elements(with_tag_name("td").to_left_of({By.ID: "right"}))
291287

292288
ids = [el.get_attribute("id") for el in elements]
293-
assert ids.count() == 2
289+
assert len(ids) == 2
294290
assert "left" in ids
295291
assert "center" in ids
296292

@@ -301,7 +297,6 @@ def test_should_find_elements_straight_right_of_another(driver, pages):
301297
elements = driver.find_elements(with_tag_name("td").to_right_of({By.ID: "left"}))
302298

303299
ids = [el.get_attribute("id") for el in elements]
304-
assert ids.count() == 2
300+
assert len(ids) == 2
305301
assert "right" in ids
306302
assert "center" in ids
307-

0 commit comments

Comments
 (0)