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 |
How QTP recognize the object??how to add objcts into object repository??
Hi, When I click on a hyperlink a secondary pop-window will open. In that pop-up window there will be 'N' number of records arranged in with paging option in datagrid table. Each rows contains two columns, one is text and the other is a radio button. I will pass the first column value and based in it the tool have to select the corresponding radio button in that row. Please someone help me how to handle this as am new to QTP.
how to write xml output check point bu useing descriptive programing .means without useing output check point
How can we close all webbrowsers which are opened in out desctop?
There are 10 rows in the datatable. How can we fetch 2 rows and then skip 3rd row. After that, pick 4th & 5th row and skip 6th row. Please share code
Why do you choose only QTP for your project automation among remaining tools like Rational robot and silk test?
A web page title might be xxxx@xyz.com or xxxy@xxx.co or xyz@abc.in.Using what mandatory properties can be the page identified.Give the regular expression for that.
How can I replace all the text from the QTP script with some other text.
CAn anybody tell me how can I use QTP to capture any video in my application?I want to see the video file opened in my application after the tests are completed in tests results.Can anybody help me?
Could someone explain me how to work on Out put values, explain with some example on Flight Reservation. I want to insert the out put value for the order No. Please explain the steps with some example.
What are the five challenges you faced in QTP?
what is the diffrence bw qtp architectute and qtp framework?