From faddc1b0ec0d453815e3cfffce95d1b345249bc3 Mon Sep 17 00:00:00 2001 From: pinterior Date: Mon, 27 Nov 2023 20:03:12 +0900 Subject: [PATCH] add failing test to check RelativeLocator#near accept single int --- py/test/selenium/webdriver/support/relative_by_tests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/py/test/selenium/webdriver/support/relative_by_tests.py b/py/test/selenium/webdriver/support/relative_by_tests.py index 6fbd1e0344cf4..1be31f729ce6f 100644 --- a/py/test/selenium/webdriver/support/relative_by_tests.py +++ b/py/test/selenium/webdriver/support/relative_by_tests.py @@ -89,6 +89,13 @@ def test_no_such_element_is_raised_rather_than_index_error(driver, pages): assert "Cannot locate relative element with: {'id': 'nonexistentid'}" in exc.value.msg +# this test will fail with InvalidArgumentException +def test_near_locator_should_accept_single_int(driver, pages): + pages.load("relative_locators.html") + + driver.find_element(locate_with(By.ID, "rect2").near(123)) + + def test_near_locator_should_find_near_elements(driver, pages): pages.load("relative_locators.html") rect1 = driver.find_element(By.ID, "rect1")