GetSubItems Function (HtmlList)

Class

HtmlList.

Action

Returns the names of all children (sublists) of a specified list item.

Availability

This functionality is supported only if you are using the Classic Agent.

Syntax

lsChildren = list.GetSubitems ([Item])
Variable Description
lsChildren The names of the children. LIST OF STRING.
Item Optional: The list item. Default is to return the top-level items in list. LISTITEM.

Notes

The GetSubItems function returns all the list items that are in a sublist of Item. Duplicate list items are indexed. If Item is not specified, GetSubItems returns all top-level items in list.

GetSubItems returns only the items that are one level lower than Item. See the example.

Example

This example uses the following HtmlList:

  • Flowers

  • Trees

    • Oak
    • Pine
    • Elm
  • Birds

LIST OF STRING lsSub
 lsSub = BrowserPage.HtmlList ("#1").GetSubItems (2)
 ListPrint (lsSub)

 // Result:
 // Oak
 // Pine
 // Elm

GetSubItems returns only the items that are one level lower than Item. For example, even if the preceding list had a nested list under Pine, GetSubItems would still return the same values as in the preceding example.