Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
To Get number of menu items of a winmenu object
#1
Not Solved Rolleyes 
Here is how I have calculated number menu items and label of a menu item of a winmenu object in QTP.

Code:
For i = 1 to n  'n value should be given with expected number of menu items +1
   boolExists = winMenuObj.GetItemProperty("<Item "&CStr(i)&">", "Exists")
   If boolExists = False Then
    Exit For
    Else
        itemIndex = winMenuObj.GetItemProperty("<Item "&CStr(i)&">", "Index")
    itemLabel = winMenuObj.GetItemProperty("<Item "&CStr(i)&">", "Label")
   End If
Next

'itemIndex gives total number of items exists in the winmenu object when it comes out from the For loop
Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Set method not working for web number object Qtp_bunny 1 2,058 06-14-2018, 05:00 PM
Last Post: Ankur
  Unable to perform click operation on MDI menu/sub menu (Infragistics) with UFT 12 Mahen1108 0 3,291 06-17-2015, 05:29 PM
Last Post: Mahen1108
  Problem with menu object (UFT) Marta79 4 3,847 05-07-2015, 12:44 PM
Last Post: Marta79
  Unable to select items from WebLists CosmaShiva 8 6,574 07-23-2012, 06:23 PM
Last Post: Tarik Sheth
  Menu and Menu Item Identification Girish_Pai 1 3,493 11-04-2009, 01:58 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)