Micro Focus QTP (UFT) Forums

Full Version: Create List of all menu items
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I create a list of all the menu items and subitems in an application?
Hi,

For example you have many roles in the menu item, may be drop down box or something like tht.
You can use following code.
Following code will gove you all the items inside the drop down box.

Code:
Set objChild = Description.Create()
objChild("class").Value = "role-menu-item"

Set objChildWebTable  =  Browser("Search Patients").Page("Search Patients").WebTable("Role_WebTable").ChildObjects(objChild)

Dim arrUserRoles()
If objChildWebTable.Count <> 0 Then
ReDim arrUserRoles(objChildWebTable.Count - 1)
    For intCount = 0 To objChildWebTable.Count - 1
        arrUserRoles(intCount) = objChildWebTable(intCount).GEtROProperty("outertext")
    Next