def logOut(self, status): """ 注销登录,并处理提示 :param status: 注销确认结果: 1、是 2、否 3、取消 :return: """ status = int(status) try: pos = autoit.mouse_get_pos() autoit.mouse_click(button="left", x=pos[0], y=pos[1] + 50, clicks=1, speed=1) if status == 1: flag = uiautomation.ButtonControl( AutomationId="DialogBK.btnOk") flag.Click() elif status == 2: flag = uiautomation.ButtonControl( AutomationId="DialogBK.btnCancel") flag.Click() elif status == 3: flag = uiautomation.ButtonControl( AutomationId= "DialogBK.DialogTitle.FrameTitle.titleFrame.FrameClose") flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def test_search_img(): currentPath = os.path.abspath(os.path.dirname(__file__)) config = configparser.ConfigParser() config.read(os.path.join(currentPath, 'config.ini')) # 1. start Chrome and set to maximized driver = webdriver.Chrome(executable_path='./chromedriver.exe') driver.maximize_window() driver.implicitly_wait(10) # 2. goto 'https://www.baidu.com/' # driver.get('https://www.google.com/imghp?hl=zh-CN&tab=wi&ogbl') driver.get('https://www.baidu.com/') driver.find_element_by_class_name('soutu-btn').click() time.sleep(5) # 3. upload an image and start searching uia.ButtonControl(Name='选择文件').Click() window = uia.WindowControl(ClassName='#32770') filePath = os.path.join(currentPath, 'pythontab.jpg') uia.SendKeys(filePath) uia.ButtonControl(AutomationId='1').Click() time.sleep(10) driver.save_screenshot('1.png') # 4. get the target search result and validate it target = int(config.get('CheckPoint', 'VISIT_RESULT')) img = driver.find_element_by_css_selector( 'div.graph-row.graph-same-list > div:nth-child({0}) > div > a > div.graph-same-list-img > img' .format(target)) js4 = "arguments[0].scrollIntoView();" driver.execute_script(js4, img) img.screenshot('./tempfile/1.jpg') img1 = Image.open('./tempfile/1.jpg') img1.thumbnail((128, 128)) img2 = Image.open('./pythontab.jpg') img2.thumbnail((128, 128)) h1 = img1.histogram() h2 = img2.histogram() diff = math.sqrt( reduce(operator.add, list(map(lambda a, b: (a - b)**2, h1, h2))) / len(h1)) assert diff < 100 img1.close() img2.close() # 5. quite the test application time.sleep(5) driver.quit()
def calc(): os.system("start/b calc.exe") #找到计算器窗口 # window = uiautomation.WindowControl(searchDepth=1,Name= "计算器") window = uiautomation.WindowControl(searchDepth=1, ClassName="CalcFrame") # print(window) #判断窗口是否存在 if window.Exists(): print("找到计算器了") #置顶窗口 window.SetTopmost(isTopmost=True) # # #最大化窗口 # window.Maximize() #激活窗口(从任务栏点出来) window.SetActive() #输出应用当前坐标 # print(window.BoundingRectangle) # rest = window.BoundingRectangle # x = [rest.left,rest.right] # y = [rest.bottom,rest.top] # print(x,y) time.sleep(1) botton7 = uiautomation.ButtonControl(searchDepth=4, Name="7") botton7.Click() time.sleep(1) botton2 = uiautomation.ButtonControl(Name="加") botton2.Click() time.sleep(1) botton4 = uiautomation.ButtonControl(Name="4") botton4.Click() time.sleep(1) botton3 = uiautomation.ButtonControl(Name="等于") botton3.Click() time.sleep(1) reslult = uiautomation.TextControl(AutomationId="158") name = reslult.Name if int(name) == 11: print("测试成功") uiautomation.ButtonControl(Name="关闭").Click() else: print("测试失败")
def settings_server(server_IP, domain_server): Settings_Window = uiautomation.WindowControl(ClassName="Window") Settings_Window.SetFocus() server_List = Settings_Window.ListItemControl(Name="Server") server_List.Click() server_address = Settings_Window.TextControl(Name="Server address") Edit_ServerIP = server_address.GetNextSiblingControl() Edit_ServerIP.SendKeys('{Ctrl}' '{A}') Edit_ServerIP.SendKeys('{DEL}') Edit_ServerIP.SendKeys(server_IP) # server port 5060 text_control = Settings_Window.TextControl(Name="Server port") Edit_Port = text_control.GetNextSiblingControl() Edit_Port.SendKeys('{Ctrl}' '{A}') Edit_Port.SendKeys('{DEL}') Edit_Port.SendKeys("5060") time.sleep(1) # Transport Type: TCP TCP = Settings_Window.RadioButtonControl(Name="TCP") TCP.Click() # # domain domain = Settings_Window.TextControl(Name="Domain") Edit_Domain = domain.GetNextSiblingControl() Edit_Domain.SendKeys('{Ctrl}' '{A}') Edit_Domain.SendKeys('{DEL}') Edit_Domain.SendKeys(domain_server) time.sleep(1) btn_OK = uiautomation.ButtonControl(Name="OK") btn_OK.Click()
def login_extension(phone, password): AvayaComm_Window = uiautomation.WindowControl(Name="Avaya Communicator") AvayaComm_Window.SetFocus() #Login_Button = AvayaComm_Window.ButtonControl(AutomationID="loginButton") Login_Button = AvayaComm_Window.TextControl(Name="Not logged in") Login_Button.Click() time.sleep(1) # edit phone btn_logout = uiautomation.ButtonControl(Name="Logout") Edit_phone1 = btn_logout.GetNextSiblingControl() Edit_phone = Edit_phone1.GetFirstChildControl() Edit_phone.SendKeys('{Ctrl}' '{A}') Edit_phone.SendKeys('{DEL}') Edit_phone.SendKeys(phone) time.sleep(1) Edit_phone.SendKeys('{Tab}') # edit password Edit_password1 = Edit_phone1.GetNextSiblingControl() Edit_password = Edit_password1.GetFirstChildControl() Edit_password.SendKeys('{Ctrl}' '{A}') Edit_password.SendKeys('{DEL}') Edit_password.SendKeys(password) Edit_password.SendKeys('{Enter}') logged_station_name = AvayaComm_Window.TextControl( Name="Incorrect extension or password.") if logged_station_name.Exists(1): raise Exception("Login Station Unsuccessfully")
def test(): subprocess.Popen(path) automation.WindowControl(class_name='Qt5QWindowIcon', Name='userLoginViewClass').Refind(20, 1) window = automation.WindowControl(searchDepth=1, ClassName='Qt5QWindowIcon', Name=u'userLoginViewClass') # 用户名 edit1 = automation.EditControl(searchFromControl=window, Name=u'lineEdit_userName') edit1.DoubleClick() PressKey(0x0E) key_input('guojian') # 密码 edit2 = automation.EditControl(searchFromControl=window, Name=u'lineEdit_password') edit2.DoubleClick() key_input('8888888888888') # 验证码 edit3 = automation.EditControl(searchFromControl=window, Name=u'lineEdit_identifyCode') edit3.DoubleClick() key_input('izxf') # 确定 button = automation.ButtonControl(searchFromControl=window, Name=u'pushButton_sure') button.Click()
def exportToFile(self, days): """ 点击导出 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: # 触发导出保存界面 Name = "导出" Depth = 22 foundIndex = 3 co = ControlOperation() flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() time.sleep(60) # 配置保存路径 # TODO 优化:判定路径是否存在,不存在则创建 filePath = EXPORTPATH file = uiautomation.EditControl(AutomationId="1001") fileName = uiautomation.EditControl( AutomationId="1001").GetValuePattern().Value date = datetime.datetime.now().strftime("%Y%m%d") fileName = filePath + date + "_" + days + fileName + str( time.time()) co.give_value(file, fileName) except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def web_open_fast(self, open=None): """ 弹窗非Alert窗口时,使用键盘控制点击弹窗的按钮 :param open: :return: """ root_window = uiautomation.WindowControl(searchDepth=1, Name="RootContentServer") click_open_alert = uiautomation.ButtonControl( Name="打开 MPRTimes.ISLIFAST") click_close_fast_alert = uiautomation.ButtonControl(Name="不要打开") remeber_choose = uiautomation.CheckBoxControl( Name="记住我对MPRTimes.ISLIFAST链接的选择") if open: click_open_alert.Click() else: click_close_fast_alert.Click()
def click_logout(): OneX_Window = uiautomation.WindowControl(Name="Avaya one-X® Communicator") OneX_Window.SetFocus() onex_call = uiautomation.PaneControl(ClassName="ScrollViewer") onex_call.SetFocus() btn_setting = uiautomation.ButtonControl(AutomationId="ButtonMenu") btn_setting.Click() Menu = uiautomation.MenuControl(ClassName="ContextMenu") Menu.SetFocus() choose_logout = Menu.MenuItemControl(Name="Log Out") choose_logout.Click()
def confirmTemplate(self, status="confirm"): """ 确认请假状态 :param status: confirm 确认(默认) cancel 取消 :return: """ try: if status == "confirm": flag = uiautomation.ButtonControl( AutomationId="btn_confirmTemplate") elif status == "cancel": flag = uiautomation.ButtonControl( AutomationId="btn_cancelTemplate") else: flag = None flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def holidayAdd(self, Name="新增假日", Depth=12, foundIndex=7): """ 点击新增,添加假日 :return: """ try: flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def get_button_control(self, loc): try: if loc[0] == Wby.NAME: button_control = auto.ButtonControl(searchDepth=loc[2], Name=loc[1]) logger.info("深度为_{}_,名字为_{}__的button_control获取成功".format( loc[2], loc[1])) return button_control if loc[0] == Wby.AUTOMATIONID: button_control = auto.ButtonControl(searchDepth=loc[2], AutomationId=loc[1]) logger.info("深度为_{}_,id为_{}__的button_control获取成功".format( loc[2], loc[1])) return button_control except: if loc[0] == Wby.NAME: logger.exception("深度为_{}_,名字为_{}__的button_control获取失败".format( loc[2], loc[1])) if loc[0] == Wby.AUTOMATIONID: logger.exception("深度为_{}_,名字为_{}__的button_control获取失败".format( loc[2], loc[1]))
def refreshAccess(self, Name="刷新", Depth=12, foundIndex=9): """ 点击刷新,授权刷新 :return: """ try: flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def test_gitgui(): # Clone폴더 값 정의 clone_folder = "C:\\dev\\git\\UIAutomationExample" # Clone 대상 폴더가 존재할 경우 폴더를 지운다. import os if os.path.exists(clone_folder): os.system('rmdir /S /Q "{}"'.format(clone_folder)) # Clone 대상 폴더가 없는지 확인한다. if os.path.exists(clone_folder): assert False, "clone대상폴더가 지워지지 않음" # GIT GUI를 실행시킨다. import uiautomation as auto # 검색영역 클릭하기 auto.ButtonControl(searchDepth=3, Name='검색하려면 여기에 입력하십시오.').Click() # 검색영역에 값 입력하기 auto.EditControl(searchDepth=3, Name='검색 상자').SendKeys('git gui') # Git GUI아이콘 클릭하기 auto.TextControl(searchDepth=10, Name="Git GUI").Click() # 프로그램이 정상적으로 수행되었는지 확인한다. auto.WindowControl(searchDepth=1, Name="Git Gui") # 상단 메뉴를 통해 Clone을 수행 auto.MenuItemControl(searchDepth=8, Name="Repository").Click() auto.MenuItemControl(searchDepth=8, Name="Repository") # inspect를 통해서 menu의 AutomationId가 48이므로 이를 활용 auto.MenuItemControl(AutomationId = "48").Click() # 화면이 Clone Existing Repository 세부설정화면으로 이동되었는지 확인한다. # 아쉽게도 해당 APP은 "Clone Existing Repository"에 대한 정보를 확인할 수 없는 앱이어서 # 이후 동작으로 확인할 수 밖에 없다. # Source location 및 Target Directory 값 정의 source_location = "https://github.com/jjunghyup/UIAutomationExample.git" target_directory = "C:\\dev\\git\\UIAutomationExample" # Source Location값과 Target Directory값을 입력한다. auto.PaneControl(ClassName="TkChild", foundIndex=14).Click() auto.PaneControl(ClassName="TkChild", foundIndex=14).SendKeys(source_location) auto.PaneControl(ClassName="TkChild", foundIndex=11).Click() auto.PaneControl(ClassName="TkChild", foundIndex=11).SendKeys(target_directory) # 값이 정상적으로 입력된다. # 값을 Clipboard에 복사하고 붙여넣기 식으로 확인이 가능하지만 해당 내용은 이후에 작성 예정 # Clone 버튼을 클릭한다. auto.PaneControl(ClassName="TkChild", foundIndex=18).Click() # Clone 대상폴더가 존재하는지 확인한다. 10초 동안 확인한다. result = False for i in range(0, 10): if os.path.exists(clone_folder): result = True assert result, "clone대상폴더가 존재 하지 않음"
def batchImportClose(self, name="", Depth=None, foundIndex=None): """ 关闭批量导入窗口 :param targetId: :return: """ try: flag = uiautomation.ButtonControl(name=name, Depth=Depth, foundIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def batch_import_confirm(self, AutomationId="btn_confirm"): """ 确认批量导入 :param targetId: :return: """ try: flag = uiautomation.ButtonControl(AutomationId=AutomationId) flag.Click() return True except Exception as e: log.debug("Can not control EZAccess, because: %s" % e) return False
def closeClient( self, AutomationId="ACMainWindowClass.ACSystemTitle.systemTitleWidget.titleWidget.closeWinBtn" ): """ 关闭窗口 :param AutomationId: 元素的automantionid :return: """ try: flag = uiautomation.ButtonControl(AutomationId=AutomationId) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def accountMore( self, AutomationId="ACMainWindowClass.ACSystemTitle.systemTitleWidget.loginWidget.UserButton" ): """ 展开更多用户操作 :param AutomationId: 元素的automantionid :return: """ try: flag = uiautomation.ButtonControl(AutomationId=AutomationId) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def helpInfo( self, AutomationId="ACMainWindowClass.ACSystemTitle.systemTitleWidget.loginWidget.helpBtn" ): """ 查看帮助信息 :param AutomationId: 元素的automantionid :return: """ try: flag = uiautomation.ButtonControl(AutomationId=AutomationId) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def main(): firefoxWindow = automation.WindowControl(searchDepth = 1, ClassName = 'MozillaWindowClass') if not firefoxWindow.Exists(0): automation.Logger.WriteLine('please run Firefox first', automation.ConsoleColor.Yellow) return firefoxWindow.ShowWindow(automation.ShowWindow.Maximize) firefoxWindow.SetActive() time.sleep(1) tab = automation.TabControl(searchFromControl= firefoxWindow) newTabButton = automation.ButtonControl(searchFromControl= tab, searchDepth= 1) newTabButton.Click() edit = automation.EditControl(searchFromControl= firefoxWindow) # edit.Click() edit.SendKeys('http://global.bing.com/?rb=0&setmkt=en-us&setlang=en-us{Enter}') time.sleep(2) searchEdit = automation.FindControl(firefoxWindow, lambda c: (isinstance(c, automation.EditControl) or isinstance(c, automation.ComboBoxControl)) and c.Name == 'Enter your search term' ) # searchEdit.Click() searchEdit.SendKeys('Python-UIAutomation-for-Windows site:github.com{Enter}', 0.05) link = automation.HyperlinkControl(searchFromControl= firefoxWindow, SubName = 'yinkaisheng/Python-UIAutomation-for-Windows') automation.Win32API.PressKey(automation.Keys.VK_CONTROL) link.Click() #press control to open the page in a new tab automation.Win32API.ReleaseKey(automation.Keys.VK_CONTROL) newTab = automation.TabItemControl(searchFromControl= tab, SubName = 'yinkaisheng/Python-UIAutomation-for-Windows') newTab.Click() starButton = automation.ButtonControl(searchFromControl= firefoxWindow, Name = 'Star this repository') if starButton.Exists(5): automation.GetConsoleWindow().SetActive() automation.Logger.WriteLine('Star Python-UIAutomation-for-Windows after 2 seconds', automation.ConsoleColor.Yellow) time.sleep(2) firefoxWindow.SetActive() time.sleep(1) starButton.Click() time.sleep(2)
def search(self, Name="查询", Depth=21, foundIndex=2): """ 选择原始数据页签 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def export(self, Name="导出", Depth=22, foundIndex=3): """ 点击导出 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def delAccess(self, Name="删除授权", Depth=12, foundIndex=8): """ 点击批量删除 :param Name: :param Depth: :param foundIndex: :return: """ try: flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def addLeaveTravel(self, Name="请假/出差", Depth=21, foundIndex=1): """ 点击请假/出差 :param Name: 标签元素名称 :param Depth: 空间深度 :param foundIndex: 同种类控件序列号 :return: 页签控件 """ try: flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) flag.Click() except Exception as e: log.debug("Can not control EZAccess, because: %s" % e)
def refreshDevice(self, Name="刷新", Depth=14, foundIndex=9): """ 刷新按钮 :param Name: :param Depth: :param foundIndex: :return: """ try: flag = uiautomation.ButtonControl(Name=Name, Depth=Depth, fondIndex=foundIndex) 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 click_setting(): AvayaComm_Window = uiautomation.WindowControl(Name="Avaya Communicator") AvayaComm_Window.SetFocus() # logout old phone number not_login = AvayaComm_Window.TextControl(Name="Logged in") btn_ActionButton = AvayaComm_Window.ButtonControl( AutomationId="ActionButton") if not_login.Exists(1): not_login.Click() btn_logout = uiautomation.ButtonControl(Name="Logout") btn_logout.Click() time.sleep(2) btn_ActionButton.Click() # click Action button time.sleep(1) btn_ActionButton.Click() choose_setting = uiautomation.MenuItemControl(Name="Settings") choose_setting.Click()
def test(): subprocess.Popen(path) automation.WindowControl(class_name='Qt5QWindowIcon', RegexName='userLoginView').Refind(20, 1) window = automation.WindowControl(searchDepth=1, ClassName='Qt5QWindowIcon', RegexName=u'userLoginView') # 用户名 edit1 = automation.EditControl(searchFromControl=window, foundIndex=1) edit1.DoubleClick() PressKey(0x0E) key_input('guojian') # 密码 edit2 = automation.EditControl(searchFromControl=window, foundIndex=2) edit2.DoubleClick() key_input('8888888888888') # 验证码 edit3 = automation.EditControl(searchFromControl=window, foundIndex=3) edit3.DoubleClick() key_input('izxf') # 确定 button = automation.ButtonControl(searchFromControl=window, Name=u'确定') button.Click()
def _geekbench4_setup(): setup_path = os.path.join(os.path.expanduser("~"), 'Desktop') setup_path += '//Performance Benchmark Tool//Geekbench4//' os.chdir(setup_path) #通过命令行安装 os.system('start Geekbench-4.3.3-WindowsSetup.exe') time.sleep(1) auto.WindowControl(searchDepth = 1,Name = 'Geekbench 4 Setup').SetActive() auto.ButtonControl(searchDepth = 2,AutomationId = '1',Name = 'Next >').Click() time.sleep(1) auto.ButtonControl(searchDepth = 2,AutomationId = '1',Name = 'I Agree').Click() time.sleep(1) auto.ButtonControl(searchDepth = 2,AutomationId = '1',Name = 'Next >').Click() time.sleep(1) auto.ButtonControl(searchDepth = 2,AutomationId = '1',Name = 'Install').Click() while(1): if auto.ButtonControl(searchDepth = 2,AutomationId = '1',Name = 'Finish').Exists(): auto.CheckBoxControl(ClassName = 'Button',searchDepth = 3,Name = 'Run Geekbench 4').Click() auto.ButtonControl(searchDepth = 2,AutomationId = '1',Name = 'Finish').Click() break
def _geekbench4_run(): try: auto.WindowControl(searchDepth = 1,Name = 'Untitled - Geekbench 4 Pro').GetWindowPattern().Close() except: time.sleep(1) try: auto.WindowControl(searchDepth = 1,Name = 'Geekbench 4 Pro').GetWindowPattern().Close() except: time.sleep(1) run_path = 'C://Program Files (x86)//Geekbench 4//' os.chdir(run_path) os.system('start "" ".\Geekbench 4.exe"') """ ControlType: ButtonControl ClassName: CCPushButton AutomationId: CommandButton_101 Rect: (837,586,949,611)[112x25] Name: Enter License Handle: 0x90DA0(593312) Depth: 4 SupportedPattern: InvokePattern LegacyIAccessiblePattern """ time.sleep(2) i = 1 while(1): try: if auto.ButtonControl(Name = 'Run CPU Benchmark',searchDepth = 2,AutomationId = '120').Exists(): if auto.WindowControl(Name = 'Geekbench 4 Pro',searchDepth = 1).Exists(0.1): auto.ButtonControl(Name = 'Run CPU Benchmark',searchDepth = 2,AutomationId = '120').Click() break if auto.WindowControl(Name = 'Geekbench 4 Tryout',searchDepth = 1).Exists(0.1): auto.ButtonControl(Name = 'Enter License').Click() time.sleep(1) auto.EditControl(AutomationId = '1004',searchDepth = 4).Click() auto.EditControl(AutomationId = '1004',searchDepth = 4).SendKeys('*****@*****.**') auto.EditControl(AutomationId = '1006',searchDepth = 4).Click() auto.EditControl(AutomationId = '1006',searchDepth = 4).SendKeys('OTCRR-HDYE4-UPAJA-SJZPR-PSYTY-TUR3C-ECRZJ-QMJZF-3C6LE') auto.ButtonControl(Name = 'Unlock',searchDepth = 4).Click() auto.ButtonControl(searchDepth = 5, AutomationId = '2').Click() auto.WindowControl(Name = 'Geekbench 4 Tryout',searchDepth = 1).GetWindowPattern().Close() os.chdir(run_path) os.system('start "" "Geekbench 4.exe"') i = i+1 except: time.sleep(1) time.sleep(1) while(1): try: if not auto.WindowControl(Name = 'Benchmark Progress',searchDepth = 2).Exists(): break except: time.sleep(1) score_win = auto.PaneControl(Name = 'Geekbench Score',searchDepth = 6) result_dict = {} result_dict['Single-Core Score'] = score_win.TextControl(searchDepth = 7,foundIndex = 2).Name result_dict['Multi-Core Score'] = score_win.TextControl(searchDepth = 7,foundIndex = 4).Name time.sleep(10) auto.WindowControl(searchDepth = 1,Name = 'Untitled - Geekbench 4 Pro').GetWindowPattern().Close() auto.WindowControl(searchDepth = 1,Name = 'Geekbench 4 Pro').GetWindowPattern().Close() return result_dict