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]

4 thoughts on “How to right-click on any object using QTP”

  1. A drop down has module 1.On placing the cursor on module 1, sub-module opens for this,let's name them as module 1.1,module 1.2 and so on. I tried taking the getROProperty for a property,but script is unable to open the pages as we do with right clicks.
    Is it possible to open the webpages through right clicks,perform operation in that page and close that page?

  2. When you say.. "I tried taking the getROProperty for a property,but script is unable to open the pages"… what exactly you mean? please provide some more information on this…

  3. Hi,,, PLz Help me…
    while i clicking link on any web page it shows label box , that contains "Open Link in New Tab, Open Link in New Window,……so on.. ", How can i click "Open Link in New Window" or any other links which is exists on that Label….

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top