Beispiel #1
0
    def __read_attributes_from_map(self, locator):
        app_name = mapMgr.__getitem__(locator)["APP_NAME"].strip("'")
        control_identifiers = mapMgr.__getitem__(locator)["IDENTIFIERS"].split(
            ",")

        search_criteria = {
            i.split("=")[0]: i.split("=")[1].strip('"')
            for i in control_identifiers
        }
        return app_name, search_criteria
Beispiel #2
0
 def _map_converter(self, locator):
     '''
     map_converter() - Gets element attributes from map files
     Return dictionary
     '''
     self.elementAttr = mapMgr.__getitem__(locator)
     print("The Xpath value is : ", self.elementAttr)
     print("The Xpath Name is  : ", locator)
     return self.elementAttr
Beispiel #3
0
 def click(self, locator):
     """
     Clicks on an element identified by locator
     :param locator: user defined name from map files
     Ex: click("locator_name")
     """
     locator = self.__get_locator_for_tool(locator)
     window_identifier, control_identifier = mapMgr.__getitem__(
         locator)["IDENTIFIERS"].strip("'").split(",")
     autoit.control_click(window_identifier, control_identifier.strip('"'))
Beispiel #4
0
 def activate_window(self, locator):
     """
     Activates a window identified by locator
     :param locator: user defined name from map files
     Ex: activate_window("locator_name")
     """
     locator = self.__get_locator_for_tool(locator)
     window_identifier = mapMgr.__getitem__(locator)["IDENTIFIERS"].strip(
         "'").split(",")[0]
     autoit.win_activate(window_identifier)
Beispiel #5
0
 def send_text(self, locator, text):
     """
     Enters text in an input element identified by locator
     :param locator: user defined name from map files
     :param text: text which you want to enter
     Ex: send_text("locator_name", "hello")
     """
     locator = self.__get_locator_for_tool(locator)
     window_identifier, control_identifier = mapMgr.__getitem__(
         locator)["IDENTIFIERS"].strip("'").split(",")
     autoit.control_send(window_identifier, control_identifier.strip('"'),
                         text)
Beispiel #6
0
 def send_key(self, locator, key):
     """
     Press any key on an element identified by locator
     :param locator: user defined name from map files
     :param key: key which you want to press
     Ex: send_key("locator_name", "ENTER")
     """
     locator = self.__get_locator_for_tool(locator)
     window_identifier, control_identifier = mapMgr.__getitem__(
         locator)["IDENTIFIERS"].strip("'").split(",")
     key = "{%s}" % key
     autoit.control_send(window_identifier, control_identifier.strip('"'),
                         key)
Beispiel #7
0
    def _map_converter(self, locator, replace_dict=None):
        '''
        map_converter() - Gets element attributes from map files
        Return dictionary
        '''
        self.elementAttr = copy.deepcopy(mapMgr.__getitem__(locator))
        if replace_dict:
            for key in replace_dict:
                xpath = self.elementAttr['BY_VALUE']
                r = '!' + key + '!'
                self.elementAttr['BY_VALUE'] = xpath.replace(
                    r, str(replace_dict[key]))

        info(self.elementAttr)
        return self.elementAttr