使用Tcl扩展包cwind进行界面自动化测试
来源:互联网 发布:linux rws是什么意思 编辑:程序博客网 时间:2024/06/04 00:30
[@more@]
cwind扩展包命令介绍:
to simulate a left click on the mouse
::cwind::lclick
to simulate a right click on the mouse
::cwind::rclick
to simulate a middle click on the mouse
::cwind::mclick
to set the mouse position
::cwind::setpos
where the starting position (0 0) is the upper left corner
to get the mouse position
::cwind::getpos
to get the cursor postion based on the position of the foreground window
::cwind::getwpos
to set the cursor postion based on the position of the foreground window
::cwind::setwpos
In version 1.3
to send a message to the foreground window.
::cwind::sendmessage ?? ??
Message name is the windows's message to be sent.
Wparam and lparam are additional value.
to post a message to the foreground window.
::cwind::postmessage ?? ??
Message name is the windows's message to be posted.
Wparam and lparam are additional value.
In version 1.2
I've expanded the specification of some commands for MDI.
to put in active a window.
::cwind::show ?-exact?
Search into the list of active window's name and set in foreground this window.
Window's name is treated as a glob-style pattern.
Window's name is specified in list form,
The first element is a parent window name and the optional second element is a MDI child window name.
to get the status of a window (Maximized, Minimized or Normal).
::cwind::state ?-exact?
Window's name is treated as a glob-style pattern.
Window's name is specified in list form,
The first element is a parent window name and the optional second element is a MDI child window name.
to have a list of all opened windows.
::cwind::wlist ?-exact? ??
If Window's name is omitted, Will show you a Tcl list with all the window's name.
If Window's name is specified, Will show you a Tcl list with all the MDI child window's name.
Window's name is treated as a glob-style pattern.
In version 1.1
Due to confilcts with the Tcl command "list",
I've renamed the command ::cwind::list to ::cwind::wlist.
::cwind::wlist
to get the status of a window (Maximized, Minimized or Normal).
::cwind::state ?-exact?
Window's name is treated as a glob-style pattern.
to restore the foreground window at the original size.
::cwind::restore
to minimize the foreground window.
::cwind::minimize
to maximize the foreground window.
::cwind::maximize
to minimize all the windows.
::cwind::minimizeAll
to wait a specific window on the foreground.
::cwind::waitwind ??
Max wait is in seconds and the default value is 5.
Window's name is treated as a glob-style pattern.
In version 1.0
to send a text to the foreground window.
::cwind::send ...
Send the arguments, separated by spaces.
If you want send the spaces, enclose your text into { and }.
to put in active a window.
::cwind::show ?-exact?
Search into the list of active window's name and set in foreground this window.
Window's name is treated as a glob-style pattern.
to get the active window name.
::cwind::gettext
Get the test of the foreground window.
to get the content of the clipboard.
::cwind::getcb
to put strings into the clipboard.
::cwind::putcb
to have a list of all opened windows.
::cwind::list
Will show you a Tcl list with all the window's name.
to set the sleep time.
::cwind::sleeptime ??
Time is to ask to the system to wait before each character sent.
A sort of delay in milliseconds.
一些特殊键的用法:
如果要使用像ctrl + c这样的特殊键,必须用下面的字符串序列来表示
"|CTRL+| c |CTRL-|"
特殊键的名字对应关系如下:
"ALT+"press ALT "ALT-"release ALT "ALTL+"press left ALT key "ALTL-"release left ALT key "ALTR+" press right ALT key "ALTR-"release right ALT key "CTRL+"press CTRL "CTRL-"release CTRL "CTRLL+" press left CTRL key "CTRLL-"release left CTRL key "CTRLR+"press right CTRL key "CTRLR-"release right CTRL key "SHIFT+"press SHIFT "SHIFT-"release SHIFT "SHIFTL+"press left SHIFT key "SHIFTL-" release left SHIFT key "SHIFTR+"press right SHIFT key "SHIFTR-"release right SHIFT key "TAB" press the tabulation key "RET"press the return key "ESC"press the escape key "BACK"press the backward key "DEL"press the delete key "INS"press the insert key "HELP"press the help key "LEFT" send the cursor to the left "RIGHT"send the cursor to the right "UP"send the cursor to up "DOWN" send the cursor to down "PGUP"press the page up key "PGDN"press the page down key "HOME"press the home key "END"press the end key "F1"press the function key F1 "F2"press the function key F2 "F3"press the function key F3 "F4"press the function key F4 "F5"press the function key F5 "F6" press the function key F6 "F7"press the function key F7 "F8"press the function key F8 "F9"press the function key F9 "F10"press the function key F10 "F11"press the function key F11 "F12"press the function key F12 "NUM0"press the 0 on the key pad "NUM1"press the 1 on the key pad "NUM2" press the 2 on the key pad "NUM3"press the 3 on the key pad "NUM4"press the 4 on the key pad "NUM5"press the 5 on the key pad "NUM6"press the 6 on the key pad "NUM7"press the 7 on the key pad "NUM8"press the 8 on the key pad "NUM9"press the 9 on the key pad "NUM*"press the * on the key pad "NUM+"press the + on the key pad "NUM-"press the - on the key pad "NUM,"press the , on the key pad "NUM/"press the / on the key pad "SNAP"press the print key "APPS"press the application key "KANJI"press the kanji key "CONV"press the convert key "NCONV"press the nonconvert key
下面是一段演示程序,演示了打开一个记事本,输入hello world,打开about窗口,然后拷贝窗口到剪贴板,打开画笔,把界面抓图复制到画图程序。下面程序中使用的窗口名是按照英文操作系统的,对于中文操作系统,需要修改其中的窗口名,例如*WordPad修改为记事本的窗口名,*Paint修改为画笔的中文窗口名。
package require cwind exec $env(COMSPEC) /c start wordpad.exe & ::cwind::waitwind {*WordPad} 10::cwind::send {Hello World!} |RET| after 1000 ::cwind::send |CTRL+| a |CTRL-| after 1000::cwind::send |CTRL+| c |CTRL-| after 1000 set clip [::cwind::getcb] after 1000 ::cwind::send |END| |CTRL+| v |CTRL-| after 1000 ::cwind::send |ALT+| h |ALT-| a after 1000 ::cwind::send |ALT+| |SNAP| |ALT-| exec $env(COMSPEC) /c start mspaint.exe & ::cwind::waitwind {*Paint} 10 ::cwind::send |ALT+| e |ALT-| p exit
- 使用Tcl扩展包cwind进行界面自动化测试
- 使用Tcl扩展包cwind进行界面自动化测试
- 使用WatiN进行自动化Web界面测试
- linux嵌入式编程高手历程系列9-使用tcl-expect进行自动化测试
- 使用phantomjs进行无界面UI自动化测试
- Robot Framework使用Phantomjs进行无界面UI自动化测试
- linux无界面下—使用selenium进行自动化测试
- 自动化测试-TCL脚本语言
- 使用Robot进行自动化测试
- 使用Python进行自动化测试
- 使用Python进行自动化测试
- TCL/EXPECT自动化测试脚本
- 自动化测试专题-tcl,expect
- Tcl脚本使用tcom扩展包操作Excel文件
- 如何在linux命令行无界面下,使用selenium进行自动化测试
- 使用QTP进行自动化测试的酸甜苦辣
- Robotium_使用robotium进行自动化测试
- 使用Fitnesse进行接口自动化测试
- js 计算器
- 数位拆解 4
- 关于大型网站技术演进的思考(五):存储的瓶颈(5
- FMDB 加入数据库版本信息
- hdu acm 1281 棋盘游戏
- 使用Tcl扩展包cwind进行界面自动化测试
- 无需付费证书通过Xcode进行安装调试
- SQLServer Always On 可用性组搭建简要步骤
- 纵横字谜的答案
- 【Java学习笔记】
- java邮件解析4
- C++11 的 5 个实用特性
- Jenkins入门系列之——01第一章 Jenkins是什么?
- 文字逐渐变色(自定义View)