예제 #1
0
 def focus(self, target, value):
     locator = create_locator(target)
     element = locator.get_element(self.webdriver)
     if element.get_attribute('id'):
         self.webdriver.execute_script(
             'document.getElementById("%s").focus();' %
             element.get_attribute('id'))
예제 #2
0
    def select(self,target,value):
        # find select(target) and set it's value
        sel_elem  = create_locator(target).get_element(self.webdriver)
        if value.startswith('id='):
            raise NotImplemented
        elif value.startswith('index='):
            index=int(value[6:])
            child=sel_elem.find_elements_by_tag_name("option")[index]
        elif value.startswith('value='):
            raise NotImplemented
        elif value.startswith('label='):
            raise NotImplemented
        else:
            # assume label=
            raise NotImplemented

        child.click()
예제 #3
0
 def click(self, target, value):
     create_locator(target).get_element(self.webdriver).click()
예제 #4
0
 def check(self, target, value):
     element = create_locator(target).get_element(self.webdriver)
     if element.get_attribute('type') == 'checkbox' and not element.get_attribute('checked'):
         element.click()
예제 #5
0
 def assertText(self, target, value):
     locator = create_locator(target)
     pattern = create_pattern(value)
     return pattern.compare(locator.get_element(self.webdriver).text)
예제 #6
0
 def assertElementPresent(self, target, value):
     try:
         create_locator(target).get_element(self.webdriver)
         return True
     except NoSuchElementException:
         return False
예제 #7
0
 def typeKeys(self, target, value):
     create_locator(target).get_element(self.webdriver).send_keys(value)
예제 #8
0
 def focus(self, target, value):
     locator = create_locator(target)
     element = locator.get_element(self.webdriver)
     if element.get_attribute('id'):
         self.webdriver.execute_script('document.getElementById("%s").focus();' %
                                       element.get_attribute('id'))
예제 #9
0
 def check(self, target, value):
     element = create_locator(target).get_element(self.webdriver)
     if element.get_attribute("type") == "checkbox" and not element.get_attribute("checked"):
         element.click()
예제 #10
0
 def click(self, target, value):
     create_locator(target).get_element(self.webdriver).click()
예제 #11
0
 def check(self, target, value):
     element = create_locator(target).get_element(self.webdriver)
     if element.get_attribute(
             'type') == 'checkbox' and not element.get_attribute('checked'):
         element.click()
예제 #12
0
 def assertText(self, target, value):
     locator = create_locator(target)
     pattern = create_pattern(value)
     return pattern.compare(locator.get_element(self.webdriver).text)
예제 #13
0
 def assertElementPresent(self, target, value):
     try:
         create_locator(target).get_element(self.webdriver)
         return True
     except NoSuchElementException:
         return False
예제 #14
0
 def typeKeys(self, target, value):
     create_locator(target).get_element(self.webdriver).send_keys(value)