def is_element_available(self, locator): """ Synchronization method for making sure the element we're looking for is not only on the page, but also visible -- since Se will happily deal with things that aren't visible. Use this instead of is_element_present most of the time. """ if SaunterWebDriver.is_element_present(locator): if SaunterWebDriver.is_visible(locator): return True else: return False else: return False
def wait_for_hidden(self, locator): """ Synchronization to deal with elements that are present, but are visibility until some action triggers their hidden-ness. :raises: ElementVisiblityTimeout= """ for i in range(timeout_seconds): if SaunterWebDriver.is_visible(locator): time.sleep(1) else: break else: raise ElementVisiblityTimeout("%s visibility timed out" % locator) return True
def wait_for_visible(self, locator): """ Synchronization to deal with elements that are present, but are disabled until some action triggers their visibility. :raises: ElementVisiblityTimeout """ for i in range(timeout_seconds): try: if SaunterWebDriver.is_visible(locator): break except: pass time.sleep(1) else: raise ElementVisiblityTimeout("%s visibility timed out" % locator) return True