Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How to record right click of a context menu and click on the selection ?




341
views
asked marvit August 21, 2014 05:55 AM  

How to record right click of a context menu and click on the selection ?


           

1 Answers



 
answered By Dharma   0  
We cannot record the right click operation. But we can
achieve this by using below script.

Set menu=browser("MSN.com").Page("MSN.com").Image("F430 (�
Ferrari S.p.A.)")
idx=3 'This var. points the which option to select in the
right click menu. This var. is always the option+1 value.
Ex. If u want to select the second option then the var.
should have the value 3.
Set obj = CreateObject("Mercury.DeviceReplay")
Set WshShell = CreateObject("WScript.Shell")
'Get the absolute coordinates of the ibject
absx = menu.QueryValue("abs_x")
absy = menu.QueryValue("abs_y")
obj.MouseClick absx, absy, 2
'Optional wait statement
wait 3
For i = 1 To idx-1
WshShell.sendkeys "{DOWN}"
Next
WshShell.sendkeys "{ENTER}"
Set WshSEll = nothing
Set obj = nothing
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert