scroll

suspend fun scroll(tag: String, direction: ScrollDirection)

Performs a single scroll gesture on the container element matching string tag in the specified direction.

Primary method for scrolling scrollable containers like LazyColumn, LazyRow, or scrollable Columns. Applies a 200px displacement step per invocation:

  • Desktop JVM, Android, iOS: Dispatches a 200px Compose ScrollBy action to the scrollable container.

  • WasmJs: Dispatches 10 incremental mouse.wheel() steps totaling 200px over 500ms to simulate smooth web scrolling.

Tip: To reveal off-screen items in a LazyColumn or LazyRow without calculating pixel distances, prefer using scrollUntilVisible.

Example Usage

scroll("item_list", ScrollDirection.Down)
scroll("image_gallery", ScrollDirection.Right)

Parameters

tag

The testTag string or visible text of the scrollable container.

direction

The ScrollDirection (Up, Down, Left, Right).

See also


suspend fun scroll(selector: Selector, direction: ScrollDirection)

Performs a single scroll gesture on the container element matching selector in the specified direction.

Advanced variant using explicit selectors for scrollable container targeting. Applies a 200px displacement step per invocation.

Example Usage

scroll(tag("main_scroll_view"), ScrollDirection.Down)

Parameters

selector

The explicit Selector rule targeting the scrollable container.

direction

The ScrollDirection (Up, Down, Left, Right).

See also