Skip to content

Commit 27e31db

Browse files
Mobrockerslukeis
authored andcommitted
visibility_of_all implies it only returns elements if all visible (#2052)
* visibility_of_all implies it only returns elements if all elements are visible. This is not what the function does. visibility_of_any in my opinion correctly conveys the usage of this expected condition. * Fix visibility_of_all_elements_located test to use to visibility_of_any_elements_located
1 parent 0f20fdb commit 27e31db

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

py/selenium/webdriver/support/expected_conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __init__(self, locator):
102102
def __call__(self, driver):
103103
return _find_elements(driver, self.locator)
104104

105-
class visibility_of_all_elements_located(object):
105+
class visibility_of_any_elements_located(object):
106106
""" An expectation for checking that there is at least one element visible
107107
on a web page.
108108
locator is used to find the element

py/test/selenium/webdriver/common/webdriverwait_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ def testShouldWaitUntilAtLeastOneVisibleElementsIsFoundWhenSearchingForMany(self
8484
add_visible.click()
8585
add_hidden.click()
8686

87-
elements = WebDriverWait(self.driver, 2).until(EC.visibility_of_all_elements_located((By.CLASS_NAME, "redbox")))
87+
elements = WebDriverWait(self.driver, 2).until(EC.visibility_of_any_elements_located((By.CLASS_NAME, "redbox")))
8888
self.assertTrue(len(elements) == 2)
8989

9090
def testShouldFailToFindVisibleElementsWhenExplicitWaiting(self):
9191
self._loadPage("hidden_partially")
9292
with self.assertRaises(TimeoutException):
93-
elements = WebDriverWait(self.driver, 0.7).until(EC.visibility_of_all_elements_located((By.CLASS_NAME, "redbox")))
93+
elements = WebDriverWait(self.driver, 0.7).until(EC.visibility_of_any_elements_located((By.CLASS_NAME, "redbox")))
9494

9595
def testShouldWaitOnlyAsLongAsTimeoutSpecifiedWhenImplicitWaitsAreSet(self):
9696
self._loadPage("dynamic")

0 commit comments

Comments
 (0)