Skip to main content

scrollTo

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Scroll until an element is on screen — all of it, when it fits — then return it with a ref. These call app_scroll_to.

scrollTo​

scrollTo(target: string, options?: { direction?: 'down' | 'up' | 'left' | 'right' }): Promise<Element | null>

Examples​

Scroll down until an element is on screen​

const system = await device.scrollTo('text=System')

The same call from the command line, mobium scroll-to text=System, printed on an Android 15 emulator:

text=System is on screen after 2 scrolls down — @e9 System Languages, gestures, time, backup (button)
BeforeAfter
Before: mobium scroll-to text=System on an Android 15 emulatorAfter: mobium scroll-to text=System on an Android 15 emulator

mobium scroll-to text=System on an Android 15 emulator

Scroll a horizontal pager​

await device.scrollTo('label=Card 8', { direction: 'right' })

The same call from the command line, mobium scroll-to "label=Card 8" --direction right, printed on an Android 15 emulator:

label=Card 8 is on screen after 7 scrolls right — @e5 Card 8 (button)
BeforeAfter
Before: mobium scroll-to &quot;label=Card 8&quot; --direction right on MobiumApp&#39;s Pager Demo, Android 15 emulator: from Card 1 to where Card 8 is in the pager&#39;s view and can be tapped — it stops as soon as it is, so here only Card 8&#39;s left edge shows, at the rightAfter: mobium scroll-to &quot;label=Card 8&quot; --direction right on MobiumApp&#39;s Pager Demo, Android 15 emulator: from Card 1 to where Card 8 is in the pager&#39;s view and can be tapped — it stops as soon as it is, so here only Card 8&#39;s left edge shows, at the right

mobium scroll-to "label=Card 8" --direction right on MobiumApp's Pager Demo, Android 15 emulator: from Card 1 to where Card 8 is in the pager's view and can be tapped — it stops as soon as it is, so here only Card 8's left edge shows, at the right