def uninstall_sm_build(self): uninstallPath = utils.get_registry_value("HKEY_LOCAL_MACHINE", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\SystemManager", "UninstallString") if uninstallPath != "" and uninstallPath != None: os.startfile(uninstallPath) autoit.win_wait_active("imVision System Manager Setup") autoit.control_focus("imVision System Manager Setup", "[NAME:buttonNext]") autoit.control_click("imVision System Manager Setup", "[NAME:buttonNext]") autoit.win_wait_active("Confirm") autoit.control_focus("Confirm", "[CLASS:Button; INSTANCE:1]") autoit.control_click("Confirm", "[CLASS:Button; INSTANCE:1]") autoit.win_wait_close("imVision System Manager Setup",timeout=600) shutil.rmtree("C:/Program Files/CommScope",True)
def waitClose(self, timeout=5): ''' :description 暂停脚本的执行直至所指定窗口不再存在为止. timeout 单位为秒. :return 1:成功, 0:失败(超时). ''' return autoit.win_wait_close(self.title, timeout, text=self.text)
def uploadImage(driver, imageId, imageUrl, log): printLog(log) # item = getItemByIdUntilTimeout(browser,imageId,4)# open image upload dialog # item.click() driver.find_element_by_xpath(imageId).click() # open image upload dialog autoit.win_wait_active("Open") autoit.control_focus(config["uploadFileTitleName"], "[CLASS:Edit; INSTANCE:1]") time.sleep(0.5) autoit.control_set_text(config["uploadFileTitleName"], "[CLASS:Edit; INSTANCE:1]", imageUrl) # autoit.clip_put(imageUrl) # autoit.send("^v") time.sleep(float(config["uploadImageDelayTime"])) autoit.control_click("Open", "[CLASS:Button; INSTANCE:1]") time.sleep(1) autoit.win_wait_close("Open")
def win_wait_close(cls, title, timeout, **kwargs): """ call autoit.control_set_text 暂停脚本的执行直至所指定窗口不再存在为止 timeout 单位为秒. :return 1:成功, 0:失败(超时). """ if not isinstance(timeout, int): try: timeout = int(timeout) except Exception: timeout = 0 return autoit.win_wait_close(title, timeout=timeout, **kwargs)
def wait_window_close(self, window_name, timeout=30): """ Wait a window closed Example: | Wait Window Close | Calculator | """ autoit.win_wait_close(window_name, timeout)
def waitClose(self, timeout=5): """暂停脚本的执行直至指定窗口不存在了为止""" return autoit.win_wait_close(self.title, timeout, text=self.text)