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

Answers were Sorted based on User's Feedback



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

Answer / amarendra kothuru

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

Is This Answer Correct ?    3 Yes 0 No

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

Answer / amarendra kothuru

Hey Promod,

The way the question was asked and what you were providing
was wrong. The Answer you provided may or may not work on
all applications which generates Context menu. Your code may
work on Windows based objects and usage of "WinObject" test
object is not suggestible every time. Don;t think that QTP
always treat Context menu as WinListView or WinMenu.

But if you handle it with the code what i provided, there is
high probability to work with context menu. But your
application must be the active page at the time of
execution. Otherwise it wont perform correctly. There would
be drawbacks on each option.

Regards
Amarendra Kothuru

Is This Answer Correct ?    2 Yes 1 No

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

Answer / pramod k sirotia

Very Wrong Amarendra Kothuru
why r u taking such Complicated way.

Well First of all, i am not clear which Context menu you
are talking about, whethere is it Desktop Context menu or
menu for those object those are running on System tray as
notification Area.
BTW, 1)
If you record right click on Context menu for Deskop it
will generate script as below:
Window("Program Manager").WinListView
("SysListView32").Click 1199, 286, micRightBtn
Window("Program Manager").WinObject
("SHELLDLL_DefView").WinMenu
("ContextMenu").Select "Refresh;"

While you are running this Scirpt only one Run Error you
may be getting that is "Object is not visible" which is due
to your QTP Screen may be overlaaping of your perform
action. So please make sure while running these kind of
test, QTP should not be overlapping.

Else your test will be running fine and will show up you
result as per your action.
2) The 2nd thing is the right clik on the object over
Notification area, So i would recommed you to first hide
all those object by system property and record only object
that click you want to record, becuase those are dynamic
objects and therir postion might be change while running
the test.

Hope this will help you to get problem out

Thank you very much!

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More QTP Interview Questions

Explain script generated at the time of setting runtime property?

1 Answers  


What is recovery scenario in qtp?

0 Answers  


What is difference between function and procedure?

41 Answers   HCL, IBM, iGate, Infosys, TCS, Veritas, Wipro,


How to do the Mouse Operations in QTP. How to aacess an Image in a web application to save it on my desktop. To my Knwoledge that can be done by mouse right click on the Image and selecting 'Save the Image'option. Or Is there any alternate way to do this..

1 Answers  


we are submitting data one form to another form.defaultly it is time period set as 5sec. but it is taken 15sec what to do

5 Answers   Covansys,






How to do the scripting. Is there any inbuilt functions in qtp as in qtp-s.

0 Answers  


In QTP, What is Global action and Local action?

0 Answers   Virtusa,


In Webtable New rows getting added, we have select the name as Sandeep ,If name column is sandeep then need to check the checkbox ,we don't know the rows and columns ,Can anyone please tell me the answer.

3 Answers   Broadridge, Cigniti Technologies, HCL,


After Creation of your QTp frame work, The folders are saved in VSS or Other. plz explain brifly?

3 Answers   Infosys,


How can you identify the browser and its information using QTP script?

0 Answers  


How to make "TEST Batches" in manual testing . How it is possible plz explin in detail?

1 Answers  


what are the attributes of QTP?

3 Answers  


Categories