Ui Click
ui_clickClicks an element (by element_ref, at its center) or a screen coordinate (by coords). button left|right, count 2 = double-click. Returns {clicked, at:{x,y}} — clicked means the click event was POSTED at those coordinates, NOT that the app acted on it: CGEvent carries no delivery confirmation, so a busy, modal or input-ignoring app reports exactly the same success. Confirm the effect with ui_wait_for_element or ui_read_tree rather than trusting clicked. element_disabled is returned ONLY when the app actually publishes AXEnabled=false; a control that does not publish AXEnabled at all is treated as unknown and clicked. An element that publishes no position (some controls inside web pages) is asked to scroll into view; if it still has none, a single left click is done through its accessibility press action and the answer is {clicked, via:"press_action"} with no at; when that is refused too the error is no_bounds — use coords from a screenshot. Requires Accessibility permission.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | No | Default element if element_ref given, else coords. | |
| count | No | 1 (default) or 2 for double-click. | |
| button | No | Default left. | |
| coords | No | {x,y} in global screen points. | |
| element_ref | No | Element handle returned by ui_find_element or ui_read_tree; the click lands at that element's center. Needed when by=element, which is the default whenever element_ref is present. |