glass_scroll_to_element
Scroll a UI container until a specified accessibility element becomes visible, then return its id for subsequent clicks. Select by accessible name, role, or value.
Instructions
Scroll a container (any axis) until an accessibility element is on-screen, then return it (text-only, no image). Requires the element to be actually visible — not merely present in the a11y tree — so the returned id is usable with glass_click_element. Select by name (accessible-name substring) and/or role (e.g. "Button"); optional value_contains. direction: "up"/"down"/"left"/"right"; omit to infer it from the target's off-screen position (falls back to a vertical down→up sweep when the target isn't in the tree yet). It sweeps that way to the end, then reverses. Optional x,y aim the swipe at a specific container; by default it anchors on the target's own row/column so a container that isn't window-centered (e.g. a top toolbar) is still driven. step sets wheel notches per move (default 3). Returns {matched,elapsed_ms,element{id,role,name,bounds,states},scrolled{steps,reversed,direction}} — the id is usable with glass_click_element. Returns {matched:false} if it never becomes visible after sweeping both ends or timeout_ms (default 20000). Errors if the app exposes no accessibility tree.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Scroll anchor x (window-relative). By default the swipe anchors on the target's own row/column (falling back to the window center if it isn't in the a11y tree yet); set both `x` and `y` to point the wheel at a specific container instead. | |
| y | No | Scroll anchor y (window-relative). See `x`. | |
| name | No | Substring of the target element's accessible name (selector). `name` and/or `role` is required. | |
| role | No | Element role filter, e.g. "ListItem", "Button" (selector). | |
| step | No | Wheel notches per scroll step (default 3). A calibration escape hatch — larger covers distance faster but risks stepping past a row's/column's realized band. | |
| direction | No | Sweep direction: "up"/"down" (vertical) or "left"/"right" (horizontal). Omit to infer it from the target's off-screen position (falls back to a vertical down→up sweep when the target isn't in the a11y tree yet). The search reverses to the other end if the target isn't found first. | |
| timeout_ms | No | Give up after this long (default 20000ms); returns `{matched:false}`. | |
| value_contains | No | Additionally require the matched element's `value` to contain this substring. Not a standalone selector — `name` and/or `role` is still required. |