SilkTest高级进阶系列7-用PostMessage模拟鼠标 软件测试
SilkTest可以通过调用Windows API来向控件发送消息,从而进行特定的操作。下面这段code使用PostMessage来向计算器上的清除键发送WM_LBUTTONDOWN和WM_LBUTTONUP两个消息,从而模拟PressMouse和ReleaseMouse的操作。
view plaincopy to clipboardprint?
01.[ ] use "C:\TA\SilkTest\mswfun32.inc"
02.[ ] use "C:\TA\SilkTest\msw32.inc"
03.[ ] use "C:\TA\SilkTest\mswconst.inc"
04.[ ]
05.[+] window MainWin Calculator
06. [+] multitag "Calculator"
07. [ ] "$C:\WINNT\system32\calc.exe"
08. [+] Menu Edit
09. [ ] tag "Edit"
10. [+] MenuItem Copy
11. [+] multitag "Copy"
12. [ ] "$300"
13. [+] MenuItem Paste
14. [+] multitag "Paste"
15. [ ] "$301"
16. [+] Menu View
17. [ ] tag "View"
18. [+] MenuItem Standard
19. [+] multitag "Standard"
20. [ ] "$305"
21. [+] MenuItem Scientific
22. [+] multitag "Scientific"