Skip to content

Instantly share code, notes, and snippets.

@isaulv
Created February 16, 2012 17:12
Show Gist options
  • Select an option

  • Save isaulv/1846523 to your computer and use it in GitHub Desktop.

Select an option

Save isaulv/1846523 to your computer and use it in GitHub Desktop.
#my webdriver wait in python: this is wrapped in a class called Browser
def presence_of_at_least_one_element_located_by(self, driver, by, value)
"""Expected Condition" # Java term in the java bindings"""
try:
elements = driver.find_elements(by, value)
if elements: # if i am calling find elementS i want at least one, not an empty list
return elements
else:
return false # python webdriver wait is looking for a true or false until the timeout
except StaleElementReferenceException as sere:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment