记录python编写的第一工具脚本。
脚本内容:调用工具进行循环测试。
最后使用框架:python3+uiautomation
工具:UIspy
使用UIspy查看软件的类,调用uiautomation中方法。
下面为打开IOmeter工具的脚本
subprocess.Popen('IOmeter.exe') # 打开iometer软件 window1 = auto.WindowControl(Name="Iometer") # 进入软件 pane1 = window1.PaneControl(searchDepth=1, ClassName="AfxFrameOrView110s") # 打开脚本文件选择框 toolname = window1.ToolBarControl(ClassName="ToolbarWindow32") time.sleep(0.5) openTfile = toolname.ButtonControl(Name="Open Test Configuration File") openTfile.Click() # 定位脚本选择框 filename = auto.WindowControl(Name="Open Test Configuration File") fileedit = filename.EditControl(Name="文件名(N):") fileedit.Click() time.sleep(0.5) fileedit.SendKeys('{Back}') fileedit.SendKeys('savaid') time.sleep(0.5) fileopen = filename.ButtonControl(Name="打开(O)") fileope