To Capture mouse event Using Device replay
The Device replay feature is used to perform mouse and keyboard actions against screen coordnates that are provided. The Device replay functions are not automatically recorded, but must be programmed manually in the Expert View.
Note:
As this is an undocumented feature, you should be aware that there is no
guarantee that it will exist or function the same way in future releases of
QuickTest Professional.
1. Create the Device replay Object.
Example:
Set Devicereplay
= CreateObject("Mercury.Devicereplay")
2. Call the desired Device replay function.
Example:
Devicereplay.SendString("Hello,
World")
3. When done with the Device replay object, release it.
Example:
Set Devicereplay
= Nothing
The functions that can be used with the Device replay object are (all coodinates are relative to the top left corner of the screen):
|
Function |
Description |
|
MouseMove x, y |
Move the mouse to the screen coordinate (x,y). |
|
MouseClick x, y, button |
Move
the mouse to the screen coordinate (x,y) and click the button |
|
MouseDblClick x, y, button |
Move
the mouse to the screen coordinate (x,y) and double-click the button |
|
DragAndDrop x, y, dropx, dropy, button |
Drag
the mouse from screen coordinate (x,y) to (dropx,dropy) with the button |
|
PressKey key |
Press
a key using the ASCII code of the key. |
|
MouseDown x, y, button |
Press the mouse button on screen coordinate (x,y). |
|
MouseUp x, y, button |
Release the mouse button on screen coordinate (x,y). |
|
KeyDown key |
Press
a key using the ASCII code of the key. |
|
KeyUp key |
Release
a key using the ASCII code of the key. |
|
SendString string |
Type a string. |
Using Device replay Devicereplay
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------