Monday, March 17, 2014

QTP Mercury Device Replay

In Order to use the DeviceReplay methods, you need to create DeviceReplay object.
Set objDeviceReplay = CreateObject(“Mercury.DeviceReplay”)
We use SendKeys method to send keyboard input/keystrokes to applications that dont have automation interface. We can also send more than one keystroke at a time using Sendkeys method. To send keystrokes x,y and z, you would send the string argument “xyz”.
Note: You cannot send Print Screen key to an application.
So, the difference between Mercury DeviceReplay and Sendkeys is
SendKeys -> Support only Keyboard Operations
DeviceReplay-> Support Keyboard + Mouse Operations like Drag Drop too.
In addition to that DeviceReplay supports sending multilingual characters and symbols, while sendkeys support limited keyboard operations.
The other operational difference is dependency on QTP software.
Mercury.DeviceReplay :- It comes with QTP as a module, so you need QTP on the system and only from QTP action you can use it.
SendKeys :- It could be used in VBS script to simulate keyboard inputs with native windows shell commands. It has no dependency on QTP as such.
Mercury DeviceReplay is a powerful utility to simulate keyboard input and also for simulating mouse clicks and movements. Under Java Add-in, you can find the DeviceReplay property. At times, Object.Set and Object.Type doesnt help in QTP for some applications. You can use Mercury DeviceReplay to type Non English symbols and letters even without changing the keyboard layout or installing the special fonts.
Methods
  1. MouseMove x, y                           {Move the mouse to the screen coordinate (x,y).}
  2. MouseClick x, y, button           {Move the mouse to the screen coordinate (x,y) and click the button}(0=left; 1=middle; 2=right).
  3. MouseDblClick x, y, button    {Move the mouse to the screen coordinate (x,y) and double-click the button}(0=left; 1=middle; 2=right).
  4. DragAndDrop x, y, dropx, dropy, button       {Drag the mouse from screen coordinate (x,y) to (dropx,dropy) with the button}(0=left; 1=middle; 2=right) pressed.
  5. PressKey key      {Press a key using the ASCII code of the key.}For example, Chr(13), vbCR and vbTab.
  6. MouseDown x, y, button    { Press the mouse button on screen coordinate (x,y).}
  7. MouseUp x, y, button     {Release the mouse button on screen coordinate (x,y).}
  8. KeyDown key                       {Press a key using the ASCII code of the key.}For example, Chr(13), vbCR and vbTab.
  9. KeyUp key                           {Release a key using the ASCII code of the key.}For example, Chr(13), vbCR and vbTab.
  10. SendString string             {Type a string.}

No comments:

Post a Comment