Micro Focus QTP (UFT) Forums
Create List of all menu items - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Create List of all menu items (/Thread-Create-List-of-all-menu-items)



Create List of all menu items - LGold - 04-28-2009

How can I create a list of all the menu items and subitems in an application?


RE: Create List of all menu items - Tarik Sheth - 04-29-2009

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