首页 > 代码库 > jmeter结合autoit操作windows程序
jmeter结合autoit操作windows程序
需求:
模拟操作下图软件的控件,如拨号和挂机。
1. 下载安装好autoit后,打开finder tool,使用查找工具定位到要模拟操作的控件上,如图:
2.在finder tool中的control选项卡,可以看到该控件的信息。其它控件做类似操作
3.打开autoit的script editor,编写模拟操作控件的脚本
Dim $dialogTitle = "MicroSIP" WinActivate($dialogTitle) WinWaitActive($dialogTitle) ;1 ControlFocus("MicroSIP", "","[Class:Button;Instance:7]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:7]") ;0 ControlFocus("MicroSIP", "","[Class:Button;Instance:16]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:16]") ControlFocus("MicroSIP", "","[Class:Button;Instance:16]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:16]") ;8 ControlFocus("MicroSIP", "","[Class:Button;Instance:14]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:14]") ;6 ControlFocus("MicroSIP", "","[Class:Button;Instance:12]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:12]") ;2 ControlFocus("MicroSIP", "","[Class:Button;Instance:8]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:8]") ControlFocus("MicroSIP", "","[Class:Button;Instance:8]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:8]") ControlFocus("MicroSIP", "","[Class:Button;Instance:1]") Sleep(1000) ControlClick("MicroSIP", "","[Class:Button;Instance:1]")
4.保存为au3文件,点击scrit的tools->go。测试运行,通过后,打开autoit的script to exe工具,将步骤3的au3文件转为换exe文件
5.打开jmeter,一次添加计划、线程组->BeanShell Sampler,在beanshell中添加调用exe的java代码
Runtime rn = Runtime.getRuntime(); Process p = null; try { p = rn.exec("\"C:/callout1008622.exe\""); } catch (Exception e) { System.out.println("Error exec!"); }
6.保存后,启动jmeter,运行通过
jmeter结合autoit操作windows程序
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。