def test_search(self): # 运行网易云音乐 autoit.run(self.cloudmusic_path) time.sleep(5) # 等待网易云音乐窗口激活 autoit.win_wait_active(self.cloudmusic_title) # 按5下TAB切换至搜索框 autoit.send("{TAB 5}") # 搜索歌曲 autoit.send(self.song) time.sleep(1) # 按3下向下键选择第一首歌曲 autoit.send("{DOWN 3}") time.sleep(1) # 按回车键播放歌曲 autoit.send("{ENTER}") time.sleep(1) # 校验当前窗口标题是否含有搜索歌曲名 title = autoit.win_get_title(self.cloudmusic_title) assert self.song in title, self.song.encode('utf-8') + ' not in ' + title.encode('utf-8') # 关闭窗口 autoit.win_close(self.cloudmusic_title)
def Install_CQI(self): autoit.auto_it_set_option("MouseClickDelay", 1000) autoit.run( "D:\CareFusion\CQI 4.3\Release\Guardrails CQI - Setup-4.3.exe") window_name = "[Class:MsiDialogCloseClass]" autoit.win_wait_active(window_name, 30) autoit.control_wait_visible(window_name, "[ID:2271]", 30) autoit.control_click_wait(window_name, "[ID:2271]", 20) # Welcome screen - Next autoit.control_click_wait(window_name, "[ID:2172]", 20) # License screen - Accept Rad Button autoit.control_wait_enabled( window_name, "[ID:2271]", 30) # Wait till Next Button is enabled after accepting autoit.control_click(window_name, "[ID:2271]") # License screen - Next autoit.control_wait_enabled(window_name, "[ID:2271]", 30) # Language screen - Next autoit.control_wait_visible(window_name, "[ID:2271]", 30) autoit.control_click(window_name, "[ID:2271]") # Language screen - Next autoit.control_wait_visible(window_name, "[ID:2271]", 30) # SetupType screen - Next autoit.control_custom_sleep( 2000) # Sometimes the event is missed. Needs a delay first. autoit.control_click_wait(window_name, "[ID:2271]", 10) # SetupType screen - Next
def test_search(self): # 运行网易云音乐 autoit.run(self.cloudmusic_path) time.sleep(5) # 等待网易云音乐窗口激活 autoit.win_wait_active(self.cloudmusic_title) # 按5下TAB切换至搜索框 autoit.send("{TAB 5}") # 搜索歌曲 autoit.send(self.song) time.sleep(1) # 按3下向下键选择第一首歌曲 autoit.send("{DOWN 3}") time.sleep(1) # 按回车键播放歌曲 autoit.send("{ENTER}") time.sleep(1) # 校验当前窗口标题是否含有搜索歌曲名 title = autoit.win_get_title(self.cloudmusic_title) assert self.song in title, self.song.encode('utf-8') + ' not in ' + title.encode('utf-8')
def test_search(self): # 运行红叮当客户端 autoit.run(self.cloudmusic_path) time.sleep(5) # 等待红叮当窗口激活 autoit.win_wait_active(self.cloudmusic_title) # 按1下TAB切换至输入框 autoit.send("{TAB 1}") # 输入用户名 autoit.send(self.user) time.sleep(2) # 按1下TAB切换至输入框 autoit.send("{TAB 1}") # 输入密码 autoit.send(self.passwd) time.sleep(2) # 按1下TAB切换至输入框 autoit.send("{TAB 1}") # 点击登录 autoit.send("{ENTER}") time.sleep(2) # # 校验当前窗口标题是否含有搜索歌曲名 # title = autoit.win_get_title(self.cloudmusic_title) # assert self.song in title, self.song.encode('utf-8') + ' not in ' + title.encode('utf-8') # # 关闭窗口 # autoit.win_close(self.cloudmusic_title)
def test_CDR(self): homepage = Homepage(self.driver) homepage.navigate() signup_form = homepage.getSignupForm() signup_form.setName("admin", "brijesh84") autoit.run("C:\Program Files (x86)\Zoiper\Zoiper.exe") autoit.win_wait_active("Zoiper", 5) autoit.control_send("Zoiper", "Edit1", "121919898222221") time.sleep(5) autoit.send("{ENTER}") time.sleep(60) time.sleep(5) self.driver.find_element_by_css_selector( "li.monitoring > a > div.menu_name").click() time.sleep(5) self.driver.find_element_by_link_text("CDR Trace").click() time.sleep(3) self.driver.find_element_by_id("rdoCdrSearchType-1").click() self.driver.find_element_by_id("txtCustomerIPAddress").send_keys( "192.168.20.155") self.driver.find_element_by_id("cdrtracesearch").click() time.sleep(5) temp = "CDR_Print" self.driver.save_screenshot("%s.png" % (temp))
def Checkfront(): while True: time.sleep(3) log.EscreverLog('Mata checkfront') os.system("taskkill /F /im CHECKFRONT.exe") time.sleep(1) log.EscreverLog('Abre checkfront') autoit.run("c:\ourofarma\CHECKFRONT.exe")
def launch_power_express(self, version, syex_env, username): autoit.process_close('PowerExpress.exe') express_path = self.get_power_express_path(version) autoit.run(express_path + ' ENV:' + syex_env + ' testuser:'******'') autoit.win_wait(title='Power Express') BuiltIn().set_test_variable('${username}', username) BuiltIn().set_suite_variable('${syex_env}', syex_env)
def jks_login(): autoit.run(spmspath) time.sleep(3) autoit.send("{TAB}") autoit.send('jks') autoit.send("{DELETE 5}") time.sleep(1) autoit.send("{TAB}") autoit.send('741852963Bmw/') autoit.send("{ENTER}")
def install_jenkins(self): autoit.auto_it_set_option("MouseClickDelay", 1000) autoit.run( "msiexec /package D:\Automation\Projects\WhiteRide\Repo\jenkins.msi" ) autoit.win_wait_active("Jenkins 1.651.2 Setup", 30) autoit.control_click_wait("Jenkins 1.651.2 Setup", "[ID:995]", 10) autoit.control_click_wait("Jenkins 1.651.2 Setup", "[ID:1100]", 10) autoit.control_click_wait("Jenkins 1.651.2 Setup", "[ID:1071]", 60) autoit.control_click_wait("Jenkins 1.651.2 Setup", "[ID:968]", 20) autoit.control_click_wait("Jenkins 1.651.2 Setup", "[ID:971]", 120)
def open_xcap(self): xcap = "C:\\Program Files\\EPIX\\XCAP" xcap += "\\program\\xcapwxx.exe -Xmx128M -myjava" autoit.run(xcap, "C:\\Users\\Public\\Documents\\EPIX\\XCAP") autoit.win_wait_active("EPIX") autoit.send("{TAB}") sleep(0.05) autoit.send("{ENTER}") sleep(0.05) autoit.win_wait_active("View #") autoit.win_activate(self._gui_title)
def main(): print("Enter main:") print("*************** t101:") autoit.run("notepad.exe") autoit.win_wait_active("[CLASS:Notepad]", 3) autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}") autoit.win_close("[CLASS:Notepad]") autoit.control_click("[Class:#32770]", "Button2") print("Level main:")
def extract_rr(filename): pid = autoit.run("C:/Program Files/Kubios/Kubios HRV Standard/kubioshrv.exe") # wait until screen is loaded assert autoit.win_wait_active(f"[TITLE:{kubios_title}]", 30) time.sleep(0.25) # get position and click menu->open x, y, _, _ = autoit.win_get_pos(f"[TITLE:{kubios_title}]") assert autoit.mouse_click(x=x+20, y=y+50, speed=10) time.sleep(0.5) assert autoit.mouse_click(x=x+20, y=y+70, speed=10) # wait for loading of file input screen assert autoit.win_wait_active(f"[TITLE:{title_open}]", 30) time.sleep(0.25) assert autoit.control_send(f"[TITLE:{title_open}]", "[CLASS:Edit]", filename) time.sleep(0.25) assert autoit.control_click(f"[TITLE:{title_open}]", "[CLASS:Button; INSTANCE:1]") time.sleep(1) # check if there was an error (if Open Data File is still there) assert not autoit.win_active(f"[TITLE:{title_open}]"), 'Failed to load!' assert os.system(f"taskkill /PID {pid} /F")==0
def openOutputMovie(self, outputFile): ''' Opens the output movie file with the installed player using autoit :param outputFile: Output movie file ''' videoPlayerDir = self.getVideoPlayer() if videoPlayerDir == '': return self.pLabel.setText('Opening Movie %s' % outputFile.split('/')[-1]) title = outputFile.split('/')[-1].split('.')[0] outputFile = outputFile.replace('/','\\') autoit.run('%s %s' % (videoPlayerDir, outputFile)) if 'QuickTime' in videoPlayerDir: autoit.win_wait(title, 100) import time # This is a hack. We wait 3 sec for the movie to load completely before sending the next signal. # Otherwise the signal is not registered. time.sleep(1) autoit.control_send(title, '', '{CTRLDOWN}0{CTRLUP}')
def __init__(self, application, app_class, app_title=None, run_type='os'): """ Definition of Desktop App Open and store instances of the desktop app for further useage :param application: application executable file name :param app_instance: application class name """ self.__app_class = app_class if run_type == 'autoit': if application is not None: autoit.run(application) instance = self.wait_for_window() if instance == 0: print("unable to create instance") print(self.autoit_text) elif run_type == 'os': os.system(application) instance = self.wait_for_window() if instance == 0: print("unable to create instance") print(self.os) elif run_type == 'os_thread': print("Run by thread run")
def start_BECivli(self): """登录BECivil""" # 判断屏幕分辨率是否为1920*1080 if verifySystemMetrics(1920, 1080) == True: pass else: raise Exception("分辨率不为1920*1080,请更改分辨率") # 判断Shell、BECivil和IM是否存在,若存在则退出 processes = [ ProcessControl(self.IMProcess), ProcessControl(self.BECivilProcess), ProcessControl(self.ShellProcess) ] for process in processes: if process.exists(): process.close() # 启动软件以及登录 try: autoit.run(self.path) except Exception as e: print(e) print('软件安装路径有误,或者软件安装路径中有中文,\nstart_APP函数中path变量前需要加r!') else: w1 = WinControl('用户登录') w1.wait() if w1.exists(): w1.controlSetText('[CLASS:Edit; INSTANCE:1]', self.username) w1.controlSetText('[CLASS:Edit; INSTANCE:2]', self.password) w1.controlSetText('[CLASS:Edit; INSTANCE:3]', self.ip) w1.controlClick('Button1') # 等待BECivil界面 w2 = WinControl(self.BECivilWin) w2.wait(25) w2.setState(3) sleep(1) """
def install_ast(): autoit.auto_it_set_option("MouseClickDelay", 1000) autoit.run("D:\Automation\Projects\WhiteRide\Repo\setup.exe") window_name = "CareFusion - Alaris System Tracking Application Configuration v3.0" autoit.win_wait_active(window_name, 30) autoit.control_wait_visible(window_name, "[ID:2495]", "IsVisible", 30) autoit.control_click_wait(window_name, "[ID:2495]", 20) # Welcome screen - Next window_name = "CareFusion - Alaris System Tracking Application Configuration v3.0 - InstallShield Wizard" autoit.win_wait_active(window_name, 30) autoit.control_click( window_name, "[ID:2602]") # Database - Select existing instance autoit.control_custom_sleep( 2000) # Sometimes the event is missed. Needs a delay first. autoit.control_click_wait(window_name, "[ID:2495]", 20) # Database - Next window_name = "CareFusion - Alaris System Tracking Application Configuration v3.0" autoit.win_wait_active(window_name, 30) autoit.control_wait_visible( window_name, "[ID:1685]", 20) # Wait till a control on the next screen is visible autoit.control_click_wait(window_name, "[ID:2495]", 20) # Database Location - Next autoit.control_wait_visible(window_name, "[ID:2524]", 10) # Wait till Install button is visible autoit.control_click(window_name, "[ID:2524]") # Ready screen - Install autoit.control_wait_visible(window_name, "[ID:2549]", 180) # Wait till Finish button is visible autoit.control_click(window_name, "[ID:2549]") # Final screen - Finish
def step_impl(context): context.wt.until( expected_conditions.visibility_of_element_located( (By.XPATH, "//input[@aria-label='To']"))) time.sleep(5) context.att = context.driver.find_element( By.XPATH, "//span[@data-automationid='splitbuttonprimary']/span/span[text()='Attach']" ) time.sleep(5) context.att.click() context.wt.until( expected_conditions.presence_of_element_located( (By.XPATH, "//span[contains(text(),'Browse this')]"))) context.brows = context.driver.find_element( By.XPATH, "//span[contains(text(),'Browse this')]") time.sleep(5) context.brows.click() time.sleep(5) autoit.run("E:\\wordtopdfbdd\\resumes\\fileup.exe") time.sleep(5)
def test_autoit_notePad(): autoit.run("notepad.exe") autoit.win_wait_active("[CLASS:Notepad]", 3) autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}") autoit.win_close("[CLASS:Notepad]") autoit.control_click("[Class:#32770]", "Button2")
def test_LME(): autoit.run("C:\Program Files (x86)\Aldon\Aldon LM 6.6\Affiniti.exe") autoit.win_wait_active("[CLASS:Notepad]", 3) autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}") autoit.win_close("[CLASS:Notepad]") autoit.control_click("[Class:#32770]", "Button2")
# -*- coding: utf-8 -*- """ Created on Sun Jul 26 10:15:21 2020 @author: srira """ import autoit import time program = 'Winword.EXE' # Find the winword.exe path in program files for MS Word pdf = 'Pdf_name.pdf' autoit.run(program + ' ' + pdf) while True: try: autoit.control_send("[Class:OpusApp]", "_WwG1", "{F12}", 0) time.sleep(2) autoit.control_click("Save As", 'Button8') autoit.win_close("[CLASS:OpusApp]") break except: continue
import autoit import time rsa_path = "C:\\Program Files\\RSA SecurID Software Token\\SecurID.exe" autoit.run(rsa_path) active = autoit.win_wait_active("NIU-RSA-PC1 - RSA SecurID Token", 10) if active == 1: autoit.send("447887") autoit.send("{Enter}") time.sleep(0.3) autoit.send( "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}{TAB}{TAB}{TAB}{TAB}{ENTER}" ) time.sleep(0.3) pin = autoit.clip_get() print(pin)
def open_pie(): #启动PIE autoit.run("C:\\Users\\admin\\Desktop\\PIE\\Release\\PIE.exe") #启动PIE autoit.win_wait_active(u"PIE(教学版", 30) #等待title窗口活跃,20秒超时
# -*- coding: utf-8 -*- __author__ = 'Jace Xu' import autoit autoit.run("notepad.exe") autoit.win_wait_active("[CLASS:Notepad]", 3) autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}") autoit.win_close("[CLASS:Notepad]") autoit.control_click("[Class:#32770]", "Button2")
def user_control_wait_text(title, control, text): while True: try: if text in autoit.control_get_text(title, control): break except: #ErrorHandle() continue scanpstPath = 'C:\Program Files (x86)\Microsoft Office\Office15\SCANPST.EXE' # path of SCANPST scanpstTitle = '[CLASS:#32770]' # title of SCANPST for pstPath in glob.glob('D:\mail\*.pst'): print("Processing %s" % pstPath) autoit.run(scanpstPath) # open exe user_control_wait_text(scanpstTitle, "Static2", '請輸入您要掃描的檔案名稱') # wait win active (background handle) #autoit.win_set_state(scanpstTitle, autoit.autoit.Properties.SW_SHOWNOACTIVATE) autoit.control_set_text(scanpstTitle, "Edit1", pstPath) # set pst path autoit.control_click(scanpstTitle, "Button2") # 啟動 user_control_wait_text(scanpstTitle, "Static2", pstPath) # wait scan finish # judgement result rstMsg = autoit.control_get_text(scanpstTitle, "Static3") print(rstMsg) if '沒有在這個檔案中找到錯誤' in rstMsg: autoit.control_click(scanpstTitle, "Button5") # 確定 else: # if need to fix autoit.control_click(scanpstTitle, "Button1") # 取消勾選備份
# @Time : 2020/10/13 14:20 # @Author : WZG # --coding:utf-8-- import autoit import time ODS_path = "D:\ODS\Debug\ODS.exe" autoit.run(ODS_path) time.sleep(3) autoit.send("admin") time.sleep(1) autoit.send("{ENTER}") time.sleep(5)
# coding=utf-8 import autoit import time autoit.run( r"C:\Users\M\Downloads\SwitchHosts-win_v3.3.11.5347\SwitchHosts.exe")
import autoit import os try: appLocation = os.environ["ProgramFiles(x86)"] appLocation += "\\Steam\\Steam.exe" autoit.run(appLocation) except: print("Steam could not be found\n")
#! /usr/bin/env python2 # coding=utf-8 import autoit import time putty = r'C:\Program Files (x86)\PuTTY\putty.exe' host_ip = '10.171.59.99' host_port = '22' username = '******' password = '******' autoit.run(putty) time.sleep(2) autoit.win_activate("PuTTY Configuration") autoit.send("{DEL}"*15) autoit.send(host_ip,1) autoit.send('{TAB}') autoit.send('{DEL}'*5) autoit.send(host_port) time.sleep(2) autoit.control_click("PuTTY Configuration","&Open") time.sleep(2) title = autoit.win_get_title(host_ip) print('title: %s' % title) autoit.win_activate(title) autoit.send(username + '{ENTER}') time.sleep(5) autoit.send(password + '{ENTER}')
import autoit from time import sleep from expects import * # Install AutoIt. # pip install -U pyautoit # pip install expects # Run Application. autoit.run(filename="notepad.exe") title_app = "Sem título - Bloco de notas" title_save = "Salvar como" confirm = "Confirmar Salvar como" new_file = "autoit exemplo.txt" new_title = "autoit exemplo.txt - Bloco de notas" # Wait open Application. autoit.win_wait_active(title=title_app) # # send commands for window active. autoit.send("3") autoit.send("*") autoit.send("10") autoit.send("=") autoit.send("30") sleep(2) text = autoit.win_get_text(title=title_app) print(text)
def launch_application(self): if not autoit.win_exists(WINDOW_START): autoit.run(self.config.get('exe', 'tmpgencvmw')) autoit.win_wait_active(WINDOW_START) autoit.win_activate(WINDOW_START)
def open_pie(): # 启动PIE autoit.run(u"D:\\PIE自动化\\PIE(教学版)_enu20160701\\Release\\PIE.exe") # 启动PIE autoit.win_wait_active(u"PIE(教学版", 30) # 等待title窗口活跃,20秒超时
import autoit autoit.control_focus("Open", "Edit1") autoit.control_set_text("Open", "Edit1", "D:\\DOP-100.png") autoit.control_click("Open", "Button1") ''' autoit.run("notepad.exe") autoit.win_wait_active("[CLASS:Notepad]", 3) autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}") autoit.win_close("[CLASS:Notepad]") autoit.control_click("[Class:#32770]", "Button2") '''
def start_app(self): self.get_system_permissions() soft_path = self.get_desktop() + "\\" + soft_name autoit.run(soft_path)
import autoit import time autoit.run("C:\\Users\\Tobias_Artur\\AppData\\Local\\Obsidian\\Obsidian") autoit.win_wait_active("Obsidian", 0) obsidian = autoit.win_get_handle("Obsidian") print(obsidian) autoit.win_move_by_handle(obsidian, 1273, 0, 1300, 1087) #time.sleep(3) #autoit.win_close_by_handle(obsidian) ############################################################################################### autoit.run("C:\\Program Files\\Mozilla Firefox\\firefox") autoit.win_wait_active("Mozilla Firefox", 0) firefox = autoit.win_get_handle("Mozilla Firefox") print(firefox) autoit.win_move_by_handle(firefox, -7, 0, 1287, 1087) #time.sleep(3) #autoit.win_close_by_handle(firefox) ############################################################################################### autoit.run("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome") #autoit.run('C:\\Program Files (x86)\\Chromium\\Application\\chrome') # With chromium, you can get away just typing in "Google" autoit.win_wait_active("ServiceNow - Google Chrome", 0) chrome = autoit.win_get_handle("ServiceNow - Google Chrome") print(chrome) autoit.win_move_by_handle(chrome, 2560, 0, 1280, 1080) #time.sleep(3)