Tuesday 19 July 2016

Mercury DeviceReplay option in QTP

Apart from SendKeys option, DeviceReplay is another alternative way to take control on objects which are not getting recognized.

The Device Replay feature is used to perform mouse and keyboard actions against screen coordinates that are provided. The Device Replay functions are not automatically recorded, but must be programmed manually in the Expert View.
1. Create the Device Replay Object.
Example:
Set DeviceReplay = CreateObject(“Mercury.DeviceReplay”)

2. Call the desired Device Replay function.
Example:
DeviceReplay.SendString(“Hello, Automation Testing 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 coordinates are relative to the top left corner of the screen)

The functions that can be used with the Device Replay object are (all coordinates are relative to the top left corner of the screen):
FunctionDescription
MouseMove x, yMove the mouse to the screen coordinate (x,y).
MouseClick x, y, buttonMove the mouse to the screen coordinate (x,y) and click the button
(0=left; 1=middle; 2=right).
MouseDblClick x, y, buttonMove the mouse to the screen coordinate (x,y) and double-click the button
(0=left; 1=middle; 2=right).
DragAndDrop x, y, dropx, dropy, buttonDrag the mouse from screen coordinate (x,y) to (dropx,dropy) with the button
(0=left; 1=middle; 2=right) pressed.
PressKey keyPress a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab.
MouseDown x, y, buttonPress the mouse button on screen coordinate (x,y).
MouseUp x, y, buttonRelease the mouse button on screen coordinate (x,y).
KeyDown keyPress a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab.
KeyUp keyRelease a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab.
SendString stringType a string.

No comments:

Post a Comment