Skip to content

Scroll

Summary

  • Internal name: Scroll
  • Category: Android UI
  • Purpose: Swipe the screen once in a direction (up, down, left, right).
  • Task type: Normal

Compatibility

  • Minimum AndroMate version: 1.1.0
  • Maximum AndroMate version: 1.1.0
  • Minimum Android: Android 13 (API 33)
  • Maximum Android tested: Android 16 (API 36)
  • Supported manufacturers:

    • Samsung (One UI 6.x / 7.x / 8.x)
    • Other manufacturers - not supported yet (Xiaomi HyperOS and Google Pixel are being adapted)
    • Required permissions:
    • ACCESSIBILITY_SERVICE

Detailed description

The Scroll task performs a single full-screen swipe gesture in a chosen direction via dispatchGesture - the same mechanism as Click In (x, y), not ACTION_SCROLL_FORWARD/ACTION_SCROLL_BACKWARD (which only work on nodes explicitly marked scrollable and don't generalize to arbitrary containers like RecyclerView, ScrollView, or WebView).

The swipe covers 60% of the screen (from 20% to 80% along the relevant axis, centered on the other axis), starting near the edge opposite the intended direction - e.g. scrolling down swipes the finger from near the bottom toward the top, exactly like a real touch scroll. For repeated scrolling until an element appears, see Scroll To Element.


Input parameters

Parameter Type Required Possible values Android Compatibility AndroMate Compatibility Default
Scroll_direction Enum / String (resolvable) Yes Up, Down, Left, Right Android 13 (API 33) -> Android 16 (API 36) 1.1.0 -> 1.1.0 ""

Output parameters

This task produces no output variable. It returns a VoidResult on success.


Exceptions

Code Exception Name Description
SCREEN-AUTOMATOR-ERROR-003 Invalid Action Type Scroll_direction isn't Up, Down, Left, or Right.
SCREEN-AUTOMATOR-ERROR-010 Screen Automator Service Not Connected The AndroMate accessibility service isn't enabled/connected.
SCREEN-AUTOMATOR-ERROR-011 Screen Automator Action Failed The gesture dispatch failed (rare - dispatchGesture is fire-and-forget and normally always succeeds at the API level).

Execution flowchart

flowchart TD
    Start([Scroll]) --> CheckConnected{Accessibility service\nconnected?}
    CheckConnected -->|No| E1[SCREEN-AUTOMATOR-ERROR-010\nSERVICE_NOT_CONNECTED]
    CheckConnected -->|Yes| Resolve{Scroll_direction\nvalid?}
    Resolve -->|No| E2[SCREEN-AUTOMATOR-ERROR-003\nINVALID_ACTION_TYPE]
    Resolve -->|Yes| Dispatch[dispatchGesture\n60% swipe in that direction]
    Dispatch --> Success([VoidResult])

    E1 --> Error([Exception])
    E2 --> Error

    style Start fill:#e3f2fd
    style Success fill:#c8e6c9
    style Error fill:#ffcdd2
    style Dispatch fill:#fff9c4

How it works:

  1. Check connection: fails fast with SERVICE_NOT_CONNECTED if the accessibility service isn't enabled.
  2. Resolve direction: maps Scroll_direction to Up/Down/Left/Right; anything else raises INVALID_ACTION_TYPE.
  3. Dispatch: a single swipe gesture covering 60% of the screen in that direction.

Code examples

Example 1 - Scroll down a list

{
  "Scroll": [
    { "id": "1", "title": "Scroll down", "Scroll_direction": "Down" }
  ]
}

Input parameter details

1. Input parameter: Scroll_direction

Which way the finger swipes - described from the content's point of view (e.g. Down reveals content below, by swiping the finger up).

Value Effect
Up Reveals content above (finger swipes down).
Down Reveals content below (finger swipes up).
Left Reveals content to the left (finger swipes right).
Right Reveals content to the right (finger swipes left).

Example

"Scroll_direction": "Down"

Output parameter details

This task has no output parameters.


Complete JSON example

{
  "Scroll": [
    { "id": "1", "title": "Scroll down once", "Scroll_direction": "Down" }
  ]
}