Skip to main content

Collapse Element

Collapses a tree node, dropdown or menu via the UIA ExpandCollapsePattern (Windows only). No-op if the element is already collapsed.

Category: Desktop Application Automation · Group: Desktop · Activity name: CollapseElement

The CollapseElement activity in the designer

Example

CollapseElement("<xPath>", checkOrphanedElements=False)

Inputs

NameTypeRequiredDefaultDescription
XPathstringYesXPath expression that identifies the target element.
Check orphaned elementsbooleanFalseWhen the element is not found by its XPath, scan the parent window's area for elements detached from the UI Automation tree. Slower; enable only for windows known to orphan their elements.