Pages

Saturday, April 9

How to right-click on any object using QTP

Hello Friends!
Following code demonstrate how to right click on a particular object using QTP.
We'll use DeviceRepaly object to do that..


Dim oDR
Set oDR=CreateObject("Mercury.DeviceReplay")
Set obj=Browser("name:=Yahoo.*").Page("title:=Yahoo.*").Webedit("name:=p")
obj.click
wait 3
x1=obj.GetroProperty("x")
y1=obj.GetroProperty("y")
oDR.MouseClick x1,y1,2


Please note that 2 in above line is for Right click. [0=left; 1=middle; 2=right]