How to simulate MouseDown and MouseUp?

1,108 views
Skip to first unread message

Roman Zilber

unread,
Mar 5, 2008, 10:06:32 AM3/5/08
to Mercu...@googlegroups.com
Hi All,

I have a problem with

WinObject(...).Drag x1, y1
WinObject(...).Drop x2, y2

When I ran to the same problems with Winrunner, I've used analog functions, such as type(), mtype()... is there way to do it in QTP?

Thanks,

Roman

Kandy

unread,
Mar 24, 2008, 7:07:25 PM3/24/08
to QTP - Mercury Quick Test Professional - Automated Software Testing
set replay settings to false and then use mousemove operations. After
you are done, reset replay settings to true.

Look in to the readme document...

Roman Zilber

unread,
Mar 25, 2008, 9:49:49 AM3/25/08
to Mercu...@googlegroups.com

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
(0=left; 1=middle; 2=right).

MouseDblClick x, y, button

Move the mouse to the screen coordinate (x,y) and double-click the button
(0=left; 1=middle; 2=right).

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.

PressKey key

Press a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab.

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.
For example, Chr(13), vbCR and vbTab.

KeyUp key

Release a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab.

SendString string

Type a string.

Using Device replay Devicereplay

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

DeiTass

unread,
Mar 26, 2008, 10:20:23 AM3/26/08
to QTP - Mercury Quick Test Professional - Automated Software Testing
If you are using the record option in QTP, you can use instead Record
Analog option (See manual).
A "movie" of your mouse will be recorded and played later.

Roman Zilber

unread,
Mar 27, 2008, 9:32:41 AM3/27/08
to Mercu...@googlegroups.com
I know what is analog recording, I don't need it. The solution was posted in my message in March 25.

Lakshmi K

unread,
Aug 5, 2014, 9:19:01 AM8/5/14
to mercu...@googlegroups.com, Mercu...@googlegroups.com, rzi...@gmail.com
Hello,
 
I have a requirement where i have to double click a row of a webtable.  I took x and y co-ords of the row and simulated the method of MousedblClick. It works perfectly on my local machine but when I try to run the same on server machine I see that doubleclick is not working.  Please let me know if you have any suggestions.
 
Thank you
Reply all
Reply to author
Forward
0 new messages