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)
Example #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)
 def click(cls, locator):
     driver = se_wrapper().connection
     
     e = cls.find_element_by_locator(locator)
     e.click()
 def quit(cls):
     driver = se_wrapper().connection
     driver.quit()
     driver.running = False
Example #5
0
 def __init__(self):
     self.driver = se_wrapper().connection
     self.config = cfg_wrapper().config
Example #6
0
 def click(cls, locator):
     driver = se_wrapper().connection
     
     e = cls.find_element_by_locator(locator)
     e.click()