07-28-2009, 06:05 PM
07-28-2009, 06:16 PM
I think QTP does not support context menu, but yes there can be different ways of handling operations on it using QTP.
If you can tell us the exact scenario what you want to do then may be I can help you.
If you can tell us the exact scenario what you want to do then may be I can help you.
07-29-2009, 10:27 AM
I have a Tree view, and the root node of Tree View has context menu. In which we right click on node of tree view and menu opens, I have to get count of items in that menu. and also i have to get their labels. How can i do that?
Let me know, if my question is still not clear?
Let me know, if my question is still not clear?
09-11-2009, 01:46 PM
Hi,
I am not sure what you want to get. But may the next part of code will help you.
Open "My Documents" and run (<Item 5> in my case has submenu):
I am not sure what you want to get. But may the next part of code will help you.
Open "My Documents" and run (<Item 5> in my case has submenu):
Code:
strWin = "My Documents"
Window("regexpwndtitle:="&strWin).Activate
wait 1
Window("regexpwndtitle:="&strWin).WinListView("regexpwndclass:=SysListView32").Select 0,micRightBtn
wait 2
Set oContMenu = Window("regexpwndtitle:="&strWin).WinObject("regexpwndclass:=SHELLDLL_DefView").WinMenu("menuobjtype:=3")
nCnt = oContMenu.GetItemProperty("", "SubMenuCount")
strMenu = oContMenu.GetItemProperty("<Item 5>", "Label") '// will return the menu string
Window("regexpwndtitle:="&strWin).WinListView("regexpwndclass:=SysListView32").Select 0,micRightBtn
bRes = oContMenu.GetItemProperty("<Item 5>", "HasSubMenu") '// if it has sub menu
wait 2
If bRes Then
Window("regexpwndtitle:="&strWin).WinListView("regexpwndclass:=SysListView32").Select 0,micRightBtn
wait 2
oContMenu.Select strMenu
nCnt2 = oContMenu.GetItemProperty("<Item 5>", "SubMenuCount")
strMenu2 = oContMenu.GetItemProperty("<Item 5>;<Item 1>", "Label") '// will return the menu string
End If