def waitForText(self, target, value): locator = create_locator(target) pattern = create_pattern(value) for i in range(self.timeout): sleep(1) try: pattern.compare(locator.get_element(self.webdriver).text) except: continue return True return False
def waitForText(self, target, value): locator = create_locator(target) pattern = create_pattern(value) print locator.get_element(self.webdriver).text return pattern.compare(locator.get_element(self.webdriver).text)
def assertTitle(self, target, value): pattern = create_pattern(target) return pattern.compare(self.webdriver.title)
def verifyText(self, target, value): locator = create_locator(target) pattern = create_pattern(value) return pattern.compare(locator.get_element(self.webdriver).text)
def assertTextPresent(self, target, value): pattern = create_pattern(target) return pattern.compare(self.webdriver.find_element_by_tag_name('body').text)
def assertLocation(self, target, value): return create_pattern(target).compare(self.webdriver.current_url)
def assertCssCount(self, target, value): elements = self.webdriver.find_elements_by_css_selector(target) return create_pattern(value).compare(len(elements))
def assertAllFields(self, target, value): return create_pattern(target).compare(self._getAllFields())
def assertAlert(self, target, value): return create_pattern(target).compare(self.webdriver.switch_to_alert().text)