Permalink
Browse files

Fix is_element_not_visible function

  • Loading branch information...
1 parent 62a5130 commit 01411b6a45ea53eb3959b90cdc902a17405c08e7 @karlwnw karlwnw committed Apr 20, 2012
Showing with 4 additions and 9 deletions.
  1. +4 −9 splinter/driver/webdriver/__init__.py
@@ -121,7 +121,7 @@ def is_element_visible(self, finder, selector, wait_time=None):
continue
return False
- # return False if all the found elements are not visible or don't exist
+ # return True if one element is not visible
def is_element_not_visible(self, finder, selector, wait_time=None):
wait_time = wait_time or self.wait_time
end_time = time.time() + wait_time
@@ -130,16 +130,11 @@ def is_element_not_visible(self, finder, selector, wait_time=None):
try:
elements = finder(selector)
if elements:
- count_invisible_elements = 0
for element in elements:
- if element.visible:
- break
- else:
- count_invisible_elements += 1
- if count_invisible_elements == len(elements):
- return True
+ if not element.visible:
+ return True
except (ElementNotVisibleException, StaleElementReferenceException) as e:
- continue
+ return True
return False
def is_element_present_by_css(self, css_selector, wait_time=None):

0 comments on commit 01411b6

Please sign in to comment.