Skip to content

Commit

Permalink
visibility_of_all implies it only returns elements if all visible (#2052
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
Mobrockers authored and lukeis committed May 5, 2016
1 parent 0f20fdb commit 27e31db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion py/selenium/webdriver/support/expected_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(self, locator):
def __call__(self, driver):
return _find_elements(driver, self.locator)

class visibility_of_all_elements_located(object):
class visibility_of_any_elements_located(object):
""" An expectation for checking that there is at least one element visible
on a web page.
locator is used to find the element
Expand Down
4 changes: 2 additions & 2 deletions py/test/selenium/webdriver/common/webdriverwait_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ def testShouldWaitUntilAtLeastOneVisibleElementsIsFoundWhenSearchingForMany(self
add_visible.click()
add_hidden.click()

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

def testShouldFailToFindVisibleElementsWhenExplicitWaiting(self):
self._loadPage("hidden_partially")
with self.assertRaises(TimeoutException):
elements = WebDriverWait(self.driver, 0.7).until(EC.visibility_of_all_elements_located((By.CLASS_NAME, "redbox")))
elements = WebDriverWait(self.driver, 0.7).until(EC.visibility_of_any_elements_located((By.CLASS_NAME, "redbox")))

def testShouldWaitOnlyAsLongAsTimeoutSpecifiedWhenImplicitWaitsAreSet(self):
self._loadPage("dynamic")
Expand Down

0 comments on commit 27e31db

Please sign in to comment.