def singndInOrOut(self, index=0, click="in" or "out"): """ 补签选中人员的某一条记录,可补签到或补签退 注:当前仅能补签页面上展示的,无翻页和滚动功能 :param index: 记录行数,以0开始 :param click: 补签类型,签到,签退 :return: """ try: # 第四个Get进入某一行 # 第五个Get定位至补签栏 # todo 增加根据条数翻页功能 # todo 增加根据条数滚动功能 flag = uiautomation.CustomControl(AutomationId="tableContainer"). \ GetFirstChildControl(). \ GetChildren()[2]. \ GetFirstChildControl(). \ GetChildren()[index]. \ GetChildren()[10]. \ GetFirstChildControl() if click == "in": flag = flag.GetFirstChildControl() elif click == "out": flag = flag.GetChildren()[1] flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def holidayPage(self, Name="", Depth=17, foundIndex=13): """ 点击每页20条,弹出20条/页,50条/页,100条/页,200条/页,foundIndex未识别 :return: """ try: flag = uiautomation.CustomControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def butSearch(self, Name="搜索", Depth=13, foundIndex=1): """ 点击搜索按键,foundIndex未识别 :return: """ try: flag = uiautomation.CustomControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def tab_access(self, Name="访问控制", Depth=12, foundIndex=4): """ 选择访问控制页签 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: # flag = uiautomation.HyperlinkControl(Name=Name, Depth=Depth, fondIndex=foundIndex) 已失效,弃用 flag = uiautomation.CustomControl(AutomationId="LinkAccessControl") flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def tab_person(self, AutomationId="LinkPersonManagement"): """ 选择人员管理页签 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: # flag = uiautomation.HyperlinkControl(Name=Name, Depth=Depth, fondIndex=foundIndex) 已失效,弃用 flag = uiautomation.CustomControl(AutomationId=AutomationId) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def wearingMask(self, Name="", Depth=24, foundIndex=6): """ 点击删除戴口罩选项 点击展开口罩下拉框 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: flag = uiautomation.CustomControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def tab_device(self, Name="设备管理", Depth=13, foundIndex=2): """ 选择设备管理页签 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: # flag = uiautomation.HyperlinkControl(Name=Name, Depth=Depth, fondIndex=foundIndex) 已失效,弃用 flag = uiautomation.CustomControl( AutomationId="LinkDeviceManagement") flag.Click() return flag except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def yzdl(self): '''用于验证登录匹配是否有办理进度跟踪字样,如果有返回1说明登录成功''' time.sleep(5) result = automation.ButtonControl(Depth=3, Name='继续') if automation.WaitForExist(result, 5): automation.SendKeys('{Enter}') time.sleep(5) automation.SendKeys('{F6}') automation.SendKeys( 'http://yct.sh.gov.cn/portal_yct/webportal/handle_progress.do?x=12' ) automation.SendKeys('{Enter}') time.sleep(5) result = automation.CustomControl(Depth=9, Name='办理进度跟踪') if automation.WaitForExist(result, 5): return 1 else: self.restart_login = True
def openDepartmentTree(self, targetId="", opentype=False): """ 人员与部门平级,按顺序编号 :param targetId: 目标的组织树ID :param opentype: 是否展开 :return: """ if not targetId: targetId = "treeDemo_1_span" try: flag = uiautomation.CustomControl( AutomationId=targetId).GetParentControl() flag.Click() if opentype: pos = autoit.mouse_get_pos() autoit.mouse_click(button="left", x=pos[0] - 45, y=pos[1], clicks=1, speed=100) except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def _3dmark_run(): try: auto.PaneControl(searchDepth = 1,Name = '3DMark Professional Edition - Google Chrome').GetPattern(10009).Close() except: time.sleep(1) try: auto.WindowControl(Name = '3DMark Professional Edition',searchDepth = 1).GetWindowPattern().Close() except: time.sleep(1) run_path = 'C://Program Files//UL//3DMark//' os.chdir(run_path) os.system('start 3DMark.exe') time.sleep(5) try: setup_path = 'C://Program Files (x86)//Google//Chrome//Application' os.chdir(setup_path) except: setup_path = os.path.join(os.path.expanduser("~"), 'AppData') setup_path +='//Local//Google//Chrome//Application//' os.chdir(setup_path) while(1): try: web_path = 'start chrome.exe --start-maximized ' + auto.TextControl(searchDepth = 8,Name = 'HOME').GetLegacyIAccessiblePattern().Value break except: time.sleep(1) try: web_path = 'start chrome.exe --start-maximized ' + auto.HyperlinkControl(searchDepth = 8,Name = 'HOME').GetLegacyIAccessiblePattern().Value break except: time.sleep(1) os.system(web_path) #关闭提示 time.sleep(4) try: auto.ButtonControl(searchDepth = 3,Name = 'Advanced').Click() auto.HyperlinkControl(searchDepth = 5,Name = 'Proceed to 127.0.0.1 (unsafe)').Click() except: time.sleep(1) try: auto.ButtonControl(searchDepth = 3,Name = '高级').Click() auto.HyperlinkControl(searchDepth = 5,Name = '继续前往127.0.0.1(不安全)').Click() except: time.sleep(1) try: auto.PaneControl(searchDepth = 1,Name = '3DMark Professional Edition - Google Chrome').SetActive() except: time.sleep(1) result_dict = {} #跳转到basic选项卡运行测试并等待结果 while(1): try: auto.HyperlinkControl(searchDepth= 8,Name = 'BENCHMARKS').Click() break except: time.sleep(1) time.sleep(3) while(1): try: auto.TextControl(searchDepth = 11,Name = 'Benchmarks').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').SendKeys('{Down 3}') auto.TextControl(searchDepth = 14,Name = 'Time Spy').Click() time.sleep(2) auto.HyperlinkControl(searchDepth = 15,Name = 'RUN').Click() break except: time.sleep(1) #等待运行结果 while(1): try: if not auto.TextControl(searchDepth = 11,Name = 'Running benchmark').Exists(0.1): break except: time.sleep(3) #光标移动到结果读取结果 time_spy = {} while(1): try: try: time_spy['Score'] = "".join(auto.CustomControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) time_result = auto.CustomControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') except: time_spy['Score'] = "".join(auto.GroupControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) time_result = auto.GroupControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') time_spy['Graphics Score'] = "".join(time_result.ListControl(searchDepth = 11,foundIndex = 1).TextControl(foundIndex = 3).Name.split()) time_spy['CPU score'] = "".join(time_result.ListControl(searchDepth = 11,foundIndex = 4).TextControl(foundIndex = 3).Name.split()) result_dict['Time Spy'] = time_spy break except: time.sleep(1) time.sleep(180) #fire strike while(1): try: auto.HyperlinkControl(searchDepth= 8,Name = 'BENCHMARKS').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').SendKeys('{Down 15}') auto.TextControl(searchDepth = 14,Name = 'Fire Strike').Click() time.sleep(2) auto.HyperlinkControl(searchDepth = 15,Name = 'RUN').Click() break except: time.sleep(1) while(1): try: if not auto.TextControl(searchDepth = 11,Name = 'Running benchmark').Exists(): break except: time.sleep(3) fire_strike = {} while(1): try: try: fire_strike['Score'] = "".join(auto.CustomControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) fire_result = auto.CustomControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') except: fire_strike['Score'] = "".join(auto.GroupControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) fire_result = auto.GroupControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') fire_strike['Graphics score'] = "".join(fire_result.ListControl(searchDepth = 11,foundIndex = 1).TextControl(foundIndex = 3).Name.split()) fire_strike['Physics score'] = "".join(fire_result.ListControl(searchDepth = 11,foundIndex = 4).TextControl(foundIndex = 3).Name.split()) fire_strike['Combined score'] = "".join(fire_result.ListControl(searchDepth = 11,foundIndex = 6).TextControl(foundIndex = 3).Name.split()) result_dict['Fire Strike'] = fire_strike break except: time.sleep(1) time.sleep(180) #Night raid while(1): try: auto.HyperlinkControl(searchDepth= 8,Name = 'BENCHMARKS').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').SendKeys('{Down 25}') auto.TextControl(searchDepth = 14,Name = 'Night Raid').Click() time.sleep(2) break except: time.sleep(1) try: if auto.HyperlinkControl(searchDepth = 15,Name = 'INSTALL').Exists(): auto.HyperlinkControl(searchDepth = 15,Name = 'INSTALL').Click() except: time.sleep(1) while(1): try: auto.HyperlinkControl(searchDepth = 15,Name = 'RUN').Click() break except: time.sleep(10) while(1): try: if not auto.TextControl(searchDepth = 11,Name = 'Running benchmark').Exists(): break except: time.sleep(3) night_raid = {} while(1): try: try: night_raid['Score'] = "".join(auto.CustomControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) night_result = auto.CustomControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') except: night_raid['Score'] = "".join(auto.GroupControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) night_result = auto.GroupControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') night_raid['Graphics score'] = "".join(night_result.ListControl(searchDepth = 11,foundIndex = 1).TextControl(foundIndex = 3).Name.split()) night_raid['CPU score'] = "".join(night_result.ListControl(searchDepth = 11,foundIndex = 4).TextControl(foundIndex = 3).Name.split()) result_dict['Night Raid'] = night_raid break except: time.sleep(1) time.sleep(180) #sky drive while(1): try: auto.HyperlinkControl(searchDepth= 8,Name = 'BENCHMARKS').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').SendKeys('{Down 25}') auto.TextControl(searchDepth = 14,Name = 'Sky Diver').Click() time.sleep(2) auto.HyperlinkControl(searchDepth = 15,Name = 'RUN').Click() break except: time.sleep(1) while(1): try: if not auto.TextControl(searchDepth = 11,Name = 'Running benchmark').Exists(): break except: time.sleep(3) sky_drive = {} while(1): try: try: sky_drive['Score'] = "".join(auto.CustomControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) sky_result = auto.CustomControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') except: sky_drive['Score'] = "".join(auto.GroupControl(searchDepth = 10,AutomationId = 'viewResultsControls').TextControl(foundIndex = 3).Name.split()) sky_result = auto.GroupControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') sky_drive['Graphics score'] = "".join(sky_result.ListControl(searchDepth = 11,foundIndex = 1).TextControl(foundIndex = 3).Name.split()) sky_drive['Physics score'] = "".join(sky_result.ListControl(searchDepth = 11,foundIndex = 4).TextControl(foundIndex = 3).Name.split()) sky_drive['Combined score'] = "".join(sky_result.ListControl(searchDepth = 11,foundIndex = 9).TextControl(foundIndex = 3).Name.split()) result_dict['Sky Drive'] = sky_drive break except: time.sleep(1) time.sleep(180) #api while(1): try: auto.HyperlinkControl(searchDepth= 8,Name = 'BENCHMARKS').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').Click() auto.TextControl(searchDepth = 11,Name = 'Benchmarks').SendKeys('{Down 30}') auto.TextControl(searchDepth = 14,Name = 'API Overhead feature test').Click() time.sleep(2) auto.HyperlinkControl(searchDepth = 15,Name = 'RUN').Click() break except: time.sleep(1) while(1): try: if not auto.TextControl(searchDepth = 11,Name = 'Running benchmark').Exists(): break except: time.sleep(3) api_score = {} while(1): try: api_result = auto.GroupControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') api_score['DirectX 11 multi-thread'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 1).TextControl(foundIndex = 3).Name.split()) api_score['DirectX 11 single-thread'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 2).TextControl(foundIndex = 3).Name.split()) api_score['DirectX 12'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 3).TextControl(foundIndex = 3).Name.split()) api_score['Vulkan'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 4).TextControl(foundIndex = 3).Name.split()) result_dict['api'] = api_score break except: api_result = auto.CustomControl(searchDepth = 10,AutomationId = 'RESULT_SINGLE') api_score['DirectX 11 multi-thread'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 1).TextControl(foundIndex = 3).Name.split()) api_score['DirectX 11 single-thread'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 2).TextControl(foundIndex = 3).Name.split()) api_score['DirectX 12'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 3).TextControl(foundIndex = 3).Name.split()) api_score['Vulkan'] = "".join(api_result.ListControl(searchDepth = 11,foundIndex = 4).TextControl(foundIndex = 3).Name.split()) result_dict['api'] = api_score break #关闭窗口 while(1): try: auto.PaneControl(searchDepth = 1,Name = '3DMark Professional Edition - Google Chrome').GetPattern(10009).Close() auto.WindowControl(Name = '3DMark Professional Edition',searchDepth = 1).GetWindowPattern().Close() break except: time.sleep(1) return result_dict
def _pcmark10_run(): try: auto.PaneControl(searchDepth = 1,Name = 'PCMark 10 Professional Edition - Google Chrome').GetPattern(10009).Close() except: time.sleep(1) try: auto.WindowControl(Name = 'PCMark 10 Professional Edition',searchDepth = 1).GetWindowPattern().Close() except: time.sleep(1) run_path = 'C://Program Files//UL//PCMark 10//' os.chdir(run_path) os.system('start /max PCMark10.exe') time.sleep(15) """ while(1): try: auto.ListItemControl(searchDepth = 7,Name = 'BENCHMARKS').Click(waitTime = 1) if auto.TextControl(searchDepth = 4,Name = 'IGNORE').Exists(): auto.TextControl(searchDepth = 4,Name = 'IGNORE').Click() break except: time.sleep(1) time.sleep(10) """ try: setup_path = 'C://Program Files (x86)//Google//Chrome//Application' os.chdir(setup_path) except: setup_path = os.path.join(os.path.expanduser("~"), 'AppData') setup_path +='//Local//Google//Chrome//Application//' os.chdir(setup_path) while(1): try: web_path = 'start chrome.exe --start-maximized ' + auto.TextControl(searchDepth = 8,Name = 'HOME').GetLegacyIAccessiblePattern().Value break except: time.sleep(1) try: web_path = 'start chrome.exe --start-maximized ' + auto.HyperlinkControl(searchDepth = 8,Name = 'HOME').GetLegacyIAccessiblePattern().Value break except: time.sleep(1) os.system(web_path) #关闭提示 time.sleep(4) try: auto.ButtonControl(searchDepth = 3,Name = 'Advanced').Click() auto.HyperlinkControl(searchDepth = 5,Name = 'Proceed to 127.0.0.1 (unsafe)').Click() except: time.sleep(1) try: auto.ButtonControl(searchDepth = 3,Name = '高级').Click() auto.HyperlinkControl(searchDepth = 5,Name = '继续前往127.0.0.1(不安全)').Click() except: time.sleep(1) try: auto.PaneControl(searchDepth = 1,Name = 'PCMark 10 Professional Edition - Google Chrome').SetActive() except: time.sleep(1) #跳转到basic选项卡运行测试并等待结果 while(1): try: auto.HyperlinkControl(searchDepth= 5,AutomationId = 'headerLogo').Click() auto.HyperlinkControl(searchDepth= 8,Name = 'BENCHMARKS').Click() break except: time.sleep(1) time.sleep(5) while(1): try: auto.TextControl(searchDepth = 13,Name = 'PCMark 10 Extended').Click() time.sleep(2) auto.HyperlinkControl(searchDepth = 10,Name = 'RUN').Click() break except: time.sleep(1) #等待运行结果 while(1): try: if auto.PaneControl(Name = 'PCMark 10 progress - Google Chrome',searchDepth = 1).Exists() == False : break except: time.sleep(10) #光标移动到结果读取结果 time.sleep(2) result_dict = {} while(1): if auto.GroupControl(searchDepth = 8,AutomationId = 'viewResults').Exists(0.1): result_win = auto.GroupControl(searchDepth = 8,AutomationId = 'viewResults') break elif auto.CustomControl(searchDepth = 8,AutomationId = 'viewResults').Exists(0.1): result_win = auto.CustomControl(searchDepth = 8,AutomationId = 'viewResults') break print(result_win) time.sleep(2) i = 0 while(1): if i == 20: i = 0 try: if result_win.CustomControl(searchDepth = 9,foundIndex = i).TextControl(searchDepth = 10,Name = 'PCMark 10 Extended').Exists(0.1): print(result_win.CustomControl(searchDepth = 9,foundIndex = i).TextControl(searchDepth = 10)) result_dict['Score'] = "".join(result_win.CustomControl(Depath = 9,foundIndex = i+1).TextControl(foundIndex = 1).Name.split()) break except: time.sleep(1) try: if result_win.GroupControl(searchDepth = 9,foundIndex = i).TextControl(searchDepth = 10,Name = 'PCMark 10 Extended').Exists(0.1): print(result_win.GroupControl(searchDepth = 9,foundIndex = i).TextControl(searchDepth = 10)) result_dict['Score'] = "".join(result_win.GroupControl(Depath = 9,foundIndex = i+1).TextControl(foundIndex = 1).Name.split()) break except: time.sleep(1) print(i) i += 1 try: result_dict['Essentials'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 1).TextControl(foundIndex = 3).Name.split()) result_dict['App Start-up Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 2).TextControl(foundIndex = 5).Name.split()) result_dict['Video Conferencing Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 3).TextControl(foundIndex = 5).Name.split()) result_dict['Web Browsing Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 4).TextControl(foundIndex = 5).Name.split()) result_dict['Productivity'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 5).TextControl(foundIndex = 3).Name.split()) result_dict['Spreadsheets Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 6).TextControl(foundIndex = 5).Name.split()) result_dict['Writing Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 7).TextControl(foundIndex = 5).Name.split()) result_dict['Digital Content Creation'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 8).TextControl(foundIndex = 3).Name.split()) result_dict['Photo Editing Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 9).TextControl(foundIndex = 5).Name.split()) result_dict['Rendering and Visualization Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 10).TextControl(foundIndex = 5).Name.split()) result_dict['Video Editing Score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 11).TextControl(foundIndex = 5).Name.split()) result_dict['Gaming'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 12).TextControl(foundIndex = 3).Name.split()) result_dict['Graphics score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 13).TextControl(foundIndex = 5).Name.split()) result_dict['Physics score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 14).TextControl(foundIndex = 5).Name.split()) result_dict['Combined score'] = "".join(result_win.ListControl(searchDepth = 9,foundIndex = 15).TextControl(foundIndex = 5).Name.split()) #关闭窗口 auto.PaneControl(searchDepth = 1,Name = 'PCMark 10 Professional Edition - Google Chrome').GetPattern(10009).Close() auto.WindowControl(Name = 'PCMark 10 Professional Edition',searchDepth = 1).GetWindowPattern().Close() except: auto.PaneControl(searchDepth = 1,Name = 'PCMark 10 Professional Edition - Google Chrome').GetPattern(10009).Close() auto.WindowControl(Name = 'PCMark 10 Professional Edition',searchDepth = 1).GetWindowPattern().Close() return result_dict
def find(self, ControlTypeName="Control", **kwargs): if ControlTypeName == "Control": control = auto.Control(**kwargs) if ControlTypeName == "ButtonControl": control = auto.ButtonControl(**kwargs) if ControlTypeName == "CalendarControl": control = auto.CalendarControl(**kwargs) if ControlTypeName == "CheckBoxControl": control = auto.CheckBoxControl(**kwargs) if ControlTypeName == "ComboBoxControl": control = auto.ComboBoxControl(**kwargs) if ControlTypeName == "CustomControl": control = auto.CustomControl(**kwargs) if ControlTypeName == "DataGridControl": control = auto.DataGridControl(**kwargs) if ControlTypeName == "DataItemControl": control = auto.DataItemControl(**kwargs) if ControlTypeName == "DocumentControl": control = auto.DocumentControl(**kwargs) if ControlTypeName == "EditControl": control = auto.EditControl(**kwargs) if ControlTypeName == "GroupControl": control = auto.GroupControl(**kwargs) if ControlTypeName == "HeaderControl": control = auto.HeaderControl(**kwargs) if ControlTypeName == "HeaderItemControl": control = auto.HeaderItemControl(**kwargs) if ControlTypeName == "HyperlinkControl": control = auto.HyperlinkControl(**kwargs) if ControlTypeName == "ImageControl": control = auto.ImageControl(**kwargs) if ControlTypeName == "ListControl": control = auto.ListControl(**kwargs) if ControlTypeName == "ListItemControl": control = auto.ListItemControl(**kwargs) if ControlTypeName == "MenuControl": control = auto.MenuControl(**kwargs) if ControlTypeName == "MenuBarControl": control = auto.MenuBarControl(**kwargs) if ControlTypeName == "MenuItemControl": control = auto.MenuItemControl(**kwargs) if ControlTypeName == "PaneControl": control = auto.PaneControl(**kwargs) if ControlTypeName == "ProgressBarControl": control = auto.ProgressBarControl(**kwargs) if ControlTypeName == "RadioButtonControl": control = auto.RadioButtonControl(**kwargs) if ControlTypeName == "ScrollBarControl": control = auto.ScrollBarControl(**kwargs) if ControlTypeName == "SemanticZoomControl": control = auto.SemanticZoomControl(**kwargs) if ControlTypeName == "SeparatorControl": control = auto.SeparatorControl(**kwargs) if ControlTypeName == "SliderControl": control = auto.SliderControl(**kwargs) if ControlTypeName == "SpinnerControl": control = auto.SpinnerControl(**kwargs) if ControlTypeName == "SplitButtonControl": control = auto.SplitButtonControl(**kwargs) if ControlTypeName == "StatusBarControl": control = auto.StatusBarControl(**kwargs) if ControlTypeName == "TabControl": control = auto.TabControl(**kwargs) if ControlTypeName == "TabItemControl": control = auto.TabItemControl(**kwargs) if ControlTypeName == "TextControl": control = auto.TextControl(**kwargs) if ControlTypeName == "ThumbControl": control = auto.ThumbControl(**kwargs) if ControlTypeName == "TitleBarControl": control = auto.TitleBarControl(**kwargs) if ControlTypeName == "ToolBarControl": control = auto.ToolBarControl(**kwargs) if ControlTypeName == "ToolTipControl": control = auto.ToolTipControl(**kwargs) if ControlTypeName == "TreeControl": control = auto.TreeControl(**kwargs) if ControlTypeName == "TreeItemControl": control = auto.TreeItemControl(**kwargs) if ControlTypeName == "WindowControl": control = auto.WindowControl(**kwargs) if control.Exists(): return control else: name = kwargs.__str__().replace(":", ":") Log.logger().error("元素查找失败%s" % name) autogui.screenshot("../log/%s.png" % name)
def execase(self): execute_button = auto.CustomControl( ClassName='SideBarTabItemView_3').ImageControl() execute_button.Click() self._log.info("点击发送报文按钮")