Beispiel #1
0
 def __call__(self, driver):
     try:
         element_text = WebFunctions.find(driver, self.locator,
                                          self.index).text
         return self.text in element_text
     except StaleElementReferenceException:
         return False
Beispiel #2
0
 def __call__(self, driver):
     """:rtype: list[WebElement]"""
     try:
         elements = WebFunctions.find_all(driver, self.locator)
         for element in elements:
             if _element_if_visible(element, visibility=False):
                 return False
         return elements
     except StaleElementReferenceException:
         return False
Beispiel #3
0
 def __call__(self, driver):
     try:
         element_text = WebFunctions.find(driver, self.locator,
                                          self.index).get_attribute("value")
         if element_text:
             return self.text in element_text
         else:
             return False
     except StaleElementReferenceException:
         return False
Beispiel #4
0
 def __call__(self, driver):
     try:
         return _element_if_visible(
             WebFunctions.find(driver, self.locator, self.index), False)
     except (NoSuchElementException, StaleElementReferenceException):
         # In the case of NoSuchElement, returns true because the element is
         # not present in DOM. The try block checks if the element is present
         # but is invisible.
         # In the case of StaleElementReference, returns true because stale
         # element reference implies that element is no longer visible.
         return True
Beispiel #5
0
 def __call__(self, driver):
     """:rtype: list[WebElement]"""
     return [
         element for element in WebFunctions.find_all(driver, self.locator)
         if _element_if_visible(element)
     ]
Beispiel #6
0
 def __call__(self, driver):
     return WebFunctions.find_all(driver, self.locator)
Beispiel #7
0
 def __call__(self, driver):
     try:
         return _element_if_visible(
             WebFunctions.find(driver, self.locator, self.index))
     except StaleElementReferenceException:
         return False
Beispiel #8
0
 def __call__(self, driver):
     try:
         element = WebFunctions.find(driver, self.locator, self.index)
         return element.is_selected() == self.is_selected
     except StaleElementReferenceException:
         return False
Beispiel #9
0
 def __call__(self, driver):
     """:rtype: WebElement"""
     return WebFunctions.find(driver, self.locator,
                              self.index).is_selected()