Skip to main content


Find a top level window matching the automation ID.

AutomationControl FindTopWindowByAutomationId(string automationId);


automationId: The Windows Automation ID.

Return Value

An AutomationControl object.


Automation Elements have an automationID to aid with selection and identification. It is intended to be a static value that is set at design time. Note that this ID might be empty. The depth of the tree searched is limited to MaxSearchDepth, the default value is 3.


AutomationControl myControl = FindTopWindowByAutomationId("1234");