scroll_to_element
Scrolls a specific element into view within web browsers or native applications using selectors or element names, eliminating manual scroll calculations for automation workflows.
Instructions
Purpose: Scroll a named element into the visible viewport without manually computing scroll amounts. Details: Two paths: (1) Chrome/Edge (CDP): provide selector — calls el.scrollIntoView({block, behavior:'instant'}) via CDP. Uses instant (not smooth) scroll so coords stabilize immediately. block controls vertical alignment (start/center/end/nearest, default: center). (2) Native apps (UIA): provide name + windowTitle — calls ScrollItemPattern.ScrollIntoView(). Returns scrolled:true on success, scrolled:false if the element doesn't expose ScrollItemPattern (fall back to scroll + screenshot). Prefer: Use over scroll + screenshot loops when you know the element name or selector. Pairs well with screenshot(detail='text') to confirm the element is now in-view (viewportPosition:'in-view'). For Chrome, browser_get_interactive shows viewportPosition for all elements — use that to decide whether scrolling is needed before calling this tool. Caveats: Chrome path requires browser_connect (CDP active). Native path requires the element to implement UIA ScrollItemPattern — some custom/third-party controls do not; in that case scrolled:false is returned. SPA virtual-scroll lists (React Virtualized, TanStack) may not respond to scrollIntoView. Examples: scroll_to_element({selector: '#create-release-btn'}) — Chrome, scroll to button scroll_to_element({name: 'Create Release', windowTitle: 'Glama'}) — native UIA scroll_to_element({selector: '.submit', block: 'start'}) — align to top of viewport
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Partial name/label of the element (UIA name match). Use for native app elements. At least one of name or selector must be provided. | |
| selector | No | CSS selector for the element (Chrome/Edge only). At least one of name or selector must be provided. | |
| windowTitle | No | Partial window title (required for native path when name is used) | |
| block | No | Vertical alignment after scroll — start/center/end/nearest (Chrome path only, default: center) | center |
| tabId | No | Tab ID (Chrome path only). Omit for first page tab. | |
| port | No | CDP port for Chrome path (default 9222) |