Exemplo n.º 1
0
    def find_elements_by_locator(cls, locator):
        driver = se_wrapper().connection

        locator_type = locator[:locator.find("=")]
        if locator_type == "":
            raise saunter.exceptions.InvalidLocatorString(locator)
        locator_value = locator[locator.find("=") + 1:]
        if locator_type == 'class':
            return driver.find_elements_by_class_name(locator_value)
        elif locator_type == 'css':
            return driver.find_elements_by_css_selector(locator_value)
        elif locator_type == 'id':
            return driver.find_elements_by_id(locator_value)
        elif locator_type == 'link':
            return driver.find_elements_by_link_text(locator_value)
        elif locator_type == 'name':
            return driver.find_elements_by_name(locator_value)
        elif locator_type == 'plink':
            return driver.find_elements_by_partial_link_text(locator_value)
        elif locator_type == 'tag':
            return driver.find_elements_by_tag_name(locator_value)
        elif locator_type == 'xpath':
            return driver.find_elements_by_xpath(locator_value)
        else:
            raise saunter.exceptions.InvalidLocatorString(locator)
Exemplo n.º 2
0
    def find_element_by_locator(cls, locator):
        driver = se_wrapper().connection

        locator_type = locator[: locator.find("=")]
        if locator_type == "":
            raise saunter.exceptions.InvalidLocatorString(locator)
        locator_value = locator[locator.find("=") + 1 :]
        if locator_type == "class":
            return driver.find_element_by_class_name(locator_value)
        elif locator_type == "css":
            return driver.find_element_by_css_selector(locator_value)
        elif locator_type == "id":
            return driver.find_element_by_id(locator_value)
        elif locator_type == "link":
            return driver.find_element_by_link_text(locator_value)
        elif locator_type == "name":
            return driver.find_element_by_name(locator_value)
        elif locator_type == "plink":
            return driver.find_element_by_partial_link_text(locator_value)
        elif locator_type == "tag":
            return driver.find_element_by_tag_name(locator_value)
        elif locator_type == "xpath":
            return driver.find_element_by_xpath(locator_value)
        else:
            raise saunter.exceptions.InvalidLocatorString(locator)
Exemplo n.º 3
0
 def click(cls, locator):
     driver = se_wrapper().connection
     
     e = cls.find_element_by_locator(locator)
     e.click()
Exemplo n.º 4
0
 def quit(cls):
     driver = se_wrapper().connection
     driver.quit()
     driver.running = False
Exemplo n.º 5
0
 def __init__(self):
     self.driver = se_wrapper().connection
     self.config = cfg_wrapper().config
Exemplo n.º 6
0
 def click(cls, locator):
     driver = se_wrapper().connection
     
     e = cls.find_element_by_locator(locator)
     e.click()