编辑: ZCYTheFirst 2012-12-15
SystemUtil Object Description An object used to control applications and processes during a run session.

在脚本运行过程中,可使用该对象控制应用程序或进程. Operations The tables below list the built-in methods and properties that you can use as operations for the SystemUtil object. 下表列出了 SystemUtil 对象的内建方法与属性. Methods BlockInput Prevents keyboard and mouse input events from reaching applications. 禁止键盘或鼠标操作. CloseDescendentProcesses Closes all processes opened by QuickTest. 关闭由 QuickTest 打开的所有进程. CloseProcessByHwnd Closes a process that is the owner of a window with the specified handle. 根据窗口的句柄找到相应的进程,并关闭该进程. CloseProcessById Closes a process according to its Process ID (PID). 关闭指定进程 PID 的进程. CloseProcessByName Closes a process according to its name. 关闭指定进程名称的进程. CloseProcessByWndTitle Closes all processes that are owners of windows with the specified title. 关闭指定窗口标题的进程. Run Runs a file or application. 运行文件或应用程序. UnblockInput Re-enables keyboard and mouse input events after a BlockInput statement was used to block them. 在BlockInput 语句禁止键盘或鼠标之后,使用 UnblockInput 语句可解除对键盘或 鼠标的禁止. BlockInput Method Description Prevents keyboard and mouse input events from reaching applications. 禁止键盘或鼠标操作. Syntax object.BlockInput Argument Description Object A test object of type SystemUtil. SystemUtil 类型的测试对象. Return Value None Remarks You can use this method to prevent a run session being accidentally interrupted by someone using the keyboard or mouse on a QuickTest Professional computer. 当电脑正在运行 QTP 脚本时,使用 BlockInput 方法可以防止因键盘或鼠标的操作扰乱 QTP 的正常运行. After using this method, keyboard and mouse input is blocked until one of the following occurs: 使用 BlockInput 方法后,使用以下方法可以解除对键盘或鼠标的禁止: ? An UnblockInput statement is used 当使用了 UnblockInput 语句后. ? A run session ends or is paused for any reason (end of test run, run error, breakpoint, and so forth) 当脚本运行结束或中断(如整个 test 结束、运行错误、断点等等). ? The Ctrl+Alt+Delete key combination is pressed on the keyboard 在键盘上按下 Ctrl+Alt+Delete 结合键后. ? A critical system error occurs 当出现了严重的系统错误时. Example Block Keyboard and Mouse Input During a Run Session 下面的例子使用 BlockInput 方法,在QTP 脚本运行过程中禁用了键盘及鼠标. Sub BlockInput_Example() SystemUtil.BlockInput Browser( Welcome: Mercury Tours ).Page( Welcome: Mercury Tours ).WebEdit( userName ).Set mercury Browser( Welcome: Mercury Tours ).Page( Welcome: Mercury Tours ).WebEdit( password ).SetSecure 4082986e39ea469e70dbf8c5a29429fe138c6efc Browser( Welcome: Mercury Tours ).Page( Welcome: Mercury Tours ).Image( Sign-In ).Click 2,

2 SystemUtil.UnblockInput End Sub UnblockInput Method Description Re-enables keyboard and mouse input events after a BlockInput statement was used to block them. 在BlockInput 语句禁止键盘或鼠标之后,使用 UnblockInput 语句可解除对键盘或鼠标的禁止. Syntax object.UnblockInput Argument Description object A test object of type SystemUtil. SystemUtil 类型的测试对象. Return Value None Remarks You can use this method to unblock keyboard and mouse input that was earlier blocked using a BlockInput statement. 如果先前使用了 BlockInput 方法禁止了键盘及鼠标,使用 UnblockInput 方法可解除禁止. Example Unblock Keyboard and Mouse Input That Was Previously Blocked 本例在开始使用 BlockInput 方法禁止了键盘及鼠标,后来使用 UnblockInput 方法解除了禁止. Sub UnblockInput_Example() SystemUtil.BlockInput Browser( Welcome: Mercury Tours ).Page( Welcome: Mercury Tours ).WebEdit( userName ).Set mercury Browser( Welcome: Mercury Tours ).Page( Welcome: Mercury Tours ).WebEdit( password ).SetSecure 4082986e39ea469e70dbf8c5a29429fe138c6efc Browser( Welcome: Mercury Tours ).Page( Welcome: Mercury Tours ).Image( Sign-In ).Click 2,

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题