Esempio n. 1
0
    def _init_UI_element(self, xml_element):
        if xml_element.tag == "{AXUI}UI_element":
            UI_element = element_module.Element()

            UI_element.name = xml_element.attrib["name"]
            if "timeout" in xml_element.attrib:
                UI_element.timeout = float(xml_element.attrib["timeout"])
            if "parent" in xml_element.attrib:
                UI_element.parent_string = xml_element.attrib["parent"]
            if "start_func" in xml_element.attrib:
                UI_element.start_func = self.get_func_by_name(
                    xml_element.attrib["start_func"])
            if "stop_func" in xml_element.attrib:
                UI_element.stop_func = self.get_func_by_name(
                    xml_element.attrib["stop_func"])
            if "identifier" in xml_element.attrib:
                UI_element.identifier_string = xml_element.attrib["identifier"]
                UI_element.identifier = identifier_parser.parse(
                    UI_element.identifier_string, lexer=identifier_lexer)

            return UI_element

        elif xml_element.tag == "{AXUI}Root_element":
            UI_element = element_module.RootElement()

            UI_element.name = xml_element.attrib["name"]

            return UI_element

        elif xml_element.tag == "{AXUI}UI_element_group":
            UI_element_group = element_module.ElementGroup()

            UI_element_group.name = xml_element.attrib["name"]
            if "timedelay" in xml_element.attrib:
                UI_element_group.timedelay = float(
                    xml_element.attrib["timedelay"])
            if "parent" in xml_element.attrib:
                UI_element_group.parent_string = xml_element.attrib["parent"]
            if "start_func" in xml_element.attrib:
                UI_element_group.start_func = self.get_func_by_name(
                    xml_element.attrib["start_func"])
            if "stop_func" in xml_element.attrib:
                UI_element_group.stop_func = self.get_func_by_name(
                    xml_element.attrib["stop_func"])
            if "identifier" in xml_element.attrib:
                UI_element_group.identifier_string = xml_element.attrib[
                    "identifier"]
                UI_element_group.identifier = identifier_parser.parse(
                    UI_element_group.identifier_string, lexer=identifier_lexer)

            return UI_element_group
Esempio n. 2
0
 def test_coordinate_identifier(self):
     import AXUI.driver.windows.Translater as translater
     from  AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser 
     identifier = "Coordinate = '(12 ,34, 56, 79)'"
     parsed_identifier = identifier_parser.parse(identifier, lexer=identifier_lexer)
     translated_identifier = translater.ID_Translater(parsed_identifier).get_translated()
     print translated_identifier
Esempio n. 3
0
 def test_index_identifier(self):
     import AXUI.driver.windows.Translater as translater
     from  AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser 
     identifier = "Name='menu bar' AND Index=3"
     parsed_identifier = identifier_parser.parse(identifier, lexer=identifier_lexer)
     translated_identifier = translater.ID_Translater(parsed_identifier).get_translated()
     print translated_identifier
Esempio n. 4
0
 def test_UIA_identifier(self):
     import AXUI.driver.windows.Translater as translater
     from  AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser 
     identifier = "Name='menu bar' AND LocalizedControlType='menu bar'"
     parsed_identifier = identifier_parser.parse(identifier, lexer=identifier_lexer)
     translated_identifier = translater.ID_Translater(parsed_identifier).get_translated()
     print translated_identifier
Esempio n. 5
0
 def test_coordinate_identifier(self):
     import AXUI.driver.windows.Translater as translater
     from  AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser 
     identifier = "Coordinate = '(12 ,34, 56, 79)'"
     parsed_identifier = identifier_parser.parse(identifier, lexer=identifier_lexer)
     translated_identifier = translater.ID_Translater(parsed_identifier).get_translated()
     print(translated_identifier)
Esempio n. 6
0
 def test_UIA_identifier(self):
     import AXUI.driver.windows.Translater as translater
     from  AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser 
     identifier = "Name='menu bar' AND LocalizedControlType='menu bar'"
     parsed_identifier = identifier_parser.parse(identifier, lexer=identifier_lexer)
     translated_identifier = translater.ID_Translater(parsed_identifier).get_translated()
     print(translated_identifier)
Esempio n. 7
0
 def test_index_identifier(self):
     import AXUI.driver.windows.Translater as translater
     from  AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser 
     identifier = "Name='menu bar' AND Index=3"
     parsed_identifier = identifier_parser.parse(identifier, lexer=identifier_lexer)
     translated_identifier = translater.ID_Translater(parsed_identifier).get_translated()
     print(translated_identifier)
Esempio n. 8
0
    def _init_UI_element(self, xml_element):
        if xml_element.tag == "{AXUI}UI_element":
            UI_element = element_module.Element()
            
            UI_element.name = xml_element.attrib["name"]
            if "timeout" in xml_element.attrib:
                UI_element.timeout = float(xml_element.attrib["timeout"])
            if "parent" in xml_element.attrib:
                UI_element.parent_string = xml_element.attrib["parent"]
            if "start_func" in xml_element.attrib:
                UI_element.start_func = self.get_func_by_name(xml_element.attrib["start_func"])
            if "stop_func" in xml_element.attrib:
                UI_element.stop_func = self.get_func_by_name(xml_element.attrib["stop_func"])
            if "identifier" in xml_element.attrib:
                UI_element.identifier_string = xml_element.attrib["identifier"]
                UI_element.identifier = identifier_parser.parse(UI_element.identifier_string, lexer=identifier_lexer)
             
            return UI_element
            
        elif xml_element.tag == "{AXUI}Root_element":
            UI_element = element_module.RootElement()
            
            UI_element.name = xml_element.attrib["name"]
            
            return UI_element
             
        elif xml_element.tag == "{AXUI}UI_element_group":
            UI_element_group = element_module.ElementGroup()

            UI_element_group.name = xml_element.attrib["name"]
            if "timedelay" in xml_element.attrib:
                UI_element_group.timedelay = float(xml_element.attrib["timedelay"])
            if "parent" in xml_element.attrib:
                UI_element_group.parent_string = xml_element.attrib["parent"]
            if "start_func" in xml_element.attrib:
                UI_element_group.start_func = self.get_func_by_name(xml_element.attrib["start_func"])
            if "stop_func" in xml_element.attrib:
                UI_element_group.stop_func = self.get_func_by_name(xml_element.attrib["stop_func"])
            if "identifier" in xml_element.attrib:
                UI_element_group.identifier_string = xml_element.attrib["identifier"]
                UI_element_group.identifier = identifier_parser.parse(UI_element_group.identifier_string, lexer=identifier_lexer)
                
            return UI_element_group
Esempio n. 9
0
 def test_wmplayer_pattern_method(self):
     import AXUI.driver.windows.UIElement as UIElement
     root_element = UIElement.get_root()
     import subprocess, time
     subprocess.Popen("\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\"")
     time.sleep(2)
     from  AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser 
     identifier = "Name='Windows Media Player' AND LocalizedControlType='window'"
     parsed_identifier = identifier_parser.parse(identifier, lexer=identifier_lexer)
     #print parsed_identifier
     wmplayer_window = root_element.find(parsed_identifier)
     self.assertEqual(wmplayer_window.WindowPattern.Close(), 0)
Esempio n. 10
0
 def test_wmplayer_pattern_method(self):
     import AXUI.driver.windows.UIElement as UIElement
     root_element = UIElement.get_root()
     import subprocess, time
     subprocess.Popen(
         "\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\"")
     time.sleep(2)
     from AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser
     identifier = "Name='Windows Media Player' AND LocalizedControlType='window'"
     parsed_identifier = identifier_parser.parse(identifier,
                                                 lexer=identifier_lexer)
     #print parsed_identifier
     wmplayer_window = root_element.find(parsed_identifier)
     self.assertEqual(wmplayer_window.WindowPattern.Close(), 0)
Esempio n. 11
0
 def test_yacc(self):
     from AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser
     print(identifier_parser.parse(self.identifier, lexer=identifier_lexer))
Esempio n. 12
0
 def test_yacc(self):
     from AXUI.parsing.identifier_parsing import identifier_lexer, identifier_parser
     print(identifier_parser.parse(self.identifier, lexer=identifier_lexer))