07-08-2010, 02:56 PM
(This post was last modified: 07-08-2010, 02:58 PM by sasmitakumari.)
Here is how I have calculated number menu items and label of a menu item of a winmenu object in QTP.
'itemIndex gives total number of items exists in the winmenu object when it comes out from the For loop
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