find_elements
Identify UI elements in Windows applications using a selector and strategy. Returns a JSON array of element IDs for reliable automation.
Instructions
Find all UI elements matching the selector. Returns a JSON array of element ID strings. Preferred strategy order for reliable automation: 1) "accessibility id" (AutomationId) — most stable, use whenever available 2) "name" — good for static labels not subject to localization 3) "xpath" — flexible fallback, e.g. //Button[@Name="OK"] 4) other strategies — use only when the above are unavailable. After interacting with an element you plan to use in generated test code, call get_element_info to capture the best locator.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | The selector value for the chosen strategy | |
| strategy | Yes | Locator strategy. "accessibility id": Maps to UIA AutomationId — most stable selector, preferred for test automation. Use when the element has a non-empty AutomationId. | "name": Maps to UIA Name property (visible label/title). Reliable when text is static and not locale-dependent. | "id": Alias for accessibility id — maps to UIA AutomationId. | "xpath": Evaluates XPath against the live UIA tree. Use as fallback when no stable AutomationId or Name exists. Example: //Button[@Name="OK"] | "class name": Maps to UIA ClassName — rarely unique on its own; use to narrow results when combined with other strategies. | "tag name": Maps to UIA ControlType (e.g. "Button", "Edit", "TextBlock"). Rarely unique; useful for finding all elements of a type. | "-windows uiautomation": Raw UIA condition expression for advanced compound queries. |