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

Why divide a test into three action calls?

1 Answers  


How do you configure QTP AND Test director?

0 Answers  


What is descriptive programming?

15 Answers   Wipro,


Hi, I have weblist which contains the data like Design change,admin edit and cost saving etc.. User doesn't know the values existed in weblist. Now the user has to select the right value from the list otherwise the test will fail. Pls help me "To select the correct value from the list"

1 Answers  


HOW TO DO THE BATCH TESTING USING QTP?

2 Answers   Ordain Solutions,






How to make arguments optional in a function?

1 Answers   Crea,


actually how many hours per one day we will work on automation (qtp) in real time

1 Answers   Synechron,


Can you write a script to check if the folder exists or not?

0 Answers  


What is TD plugin? For what purpose they are used . Ineed to connect QC9.2 with QTP 9.2 . Need to run some scripts IN QTP having the QC connectivity. Pls explain in detailed step Thanks in advnece

1 Answers   HCL,


what is the recovery scenario?

1 Answers  


why is execute file used.

1 Answers   Deloitte,


I want to do Certification course in QTP. For this I request you to suggest the best Tutorial in PDF format. Hence, if possible, kinldy mail PDF file to my mail-ID: sushmapokhriyal79@gmail.com

0 Answers  


Categories