Skip to content

Commit dc6b83e

Browse files
committed
fix more python relative locator tests
1 parent 28247d0 commit dc6b83e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ def test_should_be_able_to_use_xpath(driver, pages):
120120
def test_should_be_able_to_use_xpath_by_locator(driver, pages):
121121
pages.load("relative_locators.html")
122122

123-
elements = driver.find_elements(
124-
locate_with(By.XPATH, "//td[1]").below({By.ID: "top"}).above({By.ID: "bottomLeft"})
125-
)
123+
elements = driver.find_elements(locate_with(By.XPATH, "//td[1]").below({By.ID: "top"}).above({By.ID: "bottomLeft"}))
126124

127125
ids = [el.get_attribute("id") for el in elements]
128126
assert "left" in ids
@@ -134,7 +132,7 @@ def test_should_be_able_to_combine_straight_filters(driver, pages):
134132
elements = driver.find_elements(
135133
with_tag_name("td")
136134
.straight_below(driver.find_element(By.ID, "topRight"))
137-
.straight_to_right_of(driver.find_element(By.ID, "bottomLeft"))
135+
.straight_right_of(driver.find_element(By.ID, "bottomLeft"))
138136
)
139137

140138
ids = [el.get_attribute("id") for el in elements]
@@ -176,7 +174,7 @@ def test_near_locator_should_find_near_elements_by_locator(driver, pages):
176174

177175
def test_near_locator_should_not_find_far_elements(driver, pages):
178176
pages.load("relative_locators.html")
179-
rect3 = driver.find_element(By.ID, "rect3")
177+
rect2 = driver.find_element(By.ID, "rect2")
180178

181179
with pytest.raises(NoSuchElementException) as exc:
182180
driver.find_element(locate_with(By.ID, "rect4").near(rect3))
@@ -188,7 +186,7 @@ def test_near_locator_should_not_find_far_elements_by_locator(driver, pages):
188186
pages.load("relative_locators.html")
189187

190188
with pytest.raises(NoSuchElementException) as exc:
191-
driver.find_element(locate_with(By.ID, "rect4").near({By.ID: "rect3"}))
189+
driver.find_element(locate_with(By.ID, "rect4").near({By.ID: "rect2"}))
192190

193191
assert "Cannot locate relative element with: {'id': 'rect4'}" in exc.value.msg
194192

0 commit comments

Comments
 (0)