Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get total item in context menu?
#1
Not Solved
Hi,

I have to automate context menu, in which we right click on an object and menu opens. How can we get all the childs from this menu?

Thanks,
Reply
#2
Not Solved
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.

Reply
#3
Not Solved
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?
Reply
#4
Not Solved
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):

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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to select item within WebMenu learnasugo 4 8,107 10-11-2016, 03:35 PM
Last Post: learnasugo
  Fetching total number of records inside a webtable vidya2k2 2 3,878 06-15-2015, 02:55 PM
Last Post: venkatesh9032
  ContextMenu item disabled Powerbuilder Phread 1 4,162 05-24-2012, 10:15 AM
Last Post: Shridevi.Salagare
Question Get total links visible on a webpage Sanjay_DP 5 6,429 02-16-2012, 10:30 PM
Last Post: Parke
  to check if an item in the list is disabled or not sujaravi123 6 15,712 12-13-2011, 08:15 PM
Last Post: PrabhatN

Forum Jump:


Users browsing this thread: 1 Guest(s)