How to record right click of a context menu and click on the
selection ?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Difference between image checkpoint and bitmap checkpoint
In qtp,how to interact tool & application build?
I need to pull the data from the page which in row, column vice into excel sheet, how can it be done using QTP? eg: Name Dept xyz gdty i need the same data to be exported in excel sheet.
How can I import environment from a file on disk?
What is the difference between "call" and "callclose"
hello everyone, can anybody please tell me what are the different recording modes of QTP, and where these recording modes are present in QTP 9.2. Thanks in advance, Gaytri
tell me exact differenceb bw qtp and selenium?(could not tell open soure and licennce? difference in usage and technical difference?
How can you find Local Host Name by Using QTP?
what is difference betweem class annd object?
your coming from electrical backgroung..but y ur coming to software side?
What is the latest version of qtp?
What is the need and applications of learning VB script for a automation(QTP) engineer ain Realtime ?