码迷,mamicode.com
首页 > Windows程序 > 详细

jmeter结合autoit操作windows程序

时间:2017-06-22 20:51:39      阅读:366      评论:0      收藏:0      [点我收藏+]

标签:pre   安装   tor   get   下载   find   线程   .exe   auto   

需求:

模拟操作下图软件的控件,如拨号和挂机。

技术分享

 

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程序

标签:pre   安装   tor   get   下载   find   线程   .exe   auto   

原文地址:http://www.cnblogs.com/qiaoyeye/p/7066957.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!