# UiScrollable

Artifact: [androidx.test.uiautomator:uiautomator](https://developer.android.com/jetpack/androidx/releases/test-uiautomator) [View Source](https://cs.android.com/search?q=file:androidx/test/uiautomator/UiScrollable.java+class:androidx.test.uiautomator.UiScrollable) Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

*** ** * ** ***


```
public class UiScrollable extends UiCollection
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [androidx.test.uiautomator.UiObject](https://developer.android.com/reference/androidx/test/uiautomator/UiObject) |||
|   | ↳ | [androidx.test.uiautomator.UiCollection](https://developer.android.com/reference/androidx/test/uiautomator/UiCollection) ||
|   |   | ↳ | [androidx.test.uiautomator.UiScrollable](https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable) |

*** ** * ** ***

UiScrollable is a `https://developer.android.com/reference/androidx/test/uiautomator/UiCollection` and provides support for searching for items in scrollable layout elements. This class can be used with horizontally or vertically scrollable controls.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#UiScrollable(androidx.test.uiautomator.UiSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector container)` Constructor. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#flingBackward()()` Performs a backwards fling action with the default number of fling steps (5). |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#flingForward()()` Performs a forward fling with the default number of fling steps (5). |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#flingToBeginning(int)(int maxSwipes)` Performs a fling gesture to reach the beginning of a scrollable layout element. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#flingToEnd(int)(int maxSwipes)` Performs a fling gesture to reach the end of a scrollable layout element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByDescription(androidx.test.uiautomator.UiSelector,java.lang.String)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text )` Searches for a child element in the present scrollable container. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByDescription(androidx.test.uiautomator.UiSelector,java.lang.String,boolean)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text, boolean allowScrollSearch )` Searches for a child element in the present scrollable container. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByInstance(androidx.test.uiautomator.UiSelector,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern, int instance)` Searches for a child element in the present scrollable container that matches the selector you provided. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByText(androidx.test.uiautomator.UiSelector,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text)` Searches for a child element in the present scrollable container. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByText(androidx.test.uiautomator.UiSelector,java.lang.String,boolean)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text, boolean allowScrollSearch )` Searches for a child element in the present scrollable container. |
| `int` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getMaxSearchSwipes()()` Gets the maximum number of scrolls allowed when performing a scroll action in search of a child element. |
| `double` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getSwipeDeadZonePercentage()()` Returns the percentage of a widget's size that's considered as a no-touch zone when swiping. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollBackward()()` Performs a backward scroll with the default number of scroll steps (55). |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollBackward(int)(int steps)` Performs a backward scroll. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollDescriptionIntoView(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text)` Performs a forward scroll action on the scrollable layout element until the content-description is found, or until swipe attempts have been exhausted. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollForward()()` Performs a forward scroll with the default number of scroll steps (55). |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollForward(int)(int steps)` Performs a forward scroll. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollIntoView(androidx.test.uiautomator.UiObject)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject obj)` Perform a forward scroll action to move through the scrollable layout element until a visible item that matches the `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` is found. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollIntoView(androidx.test.uiautomator.UiSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector selector)` Perform a scroll forward action to move through the scrollable layout element until a visible item that matches the selector is found. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollTextIntoView(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text)` Performs a forward scroll action on the scrollable layout element until the text you provided is visible, or until swipe attempts have been exhausted. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollToBeginning(int)(int maxSwipes)` Scrolls to the beginning of a scrollable layout element. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollToBeginning(int,int)(int maxSwipes, int steps)` Scrolls to the beginning of a scrollable layout element. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollToEnd(int)(int maxSwipes)` Scrolls to the end of a scrollable layout element. |
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollToEnd(int,int)(int maxSwipes, int steps)` Scrolls to the end of a scrollable layout element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#setAsHorizontalList()()` Set the direction of swipes to be horizontal when performing scroll actions. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#setAsVerticalList()()` Set the direction of swipes to be vertical when performing scroll actions. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#setMaxSearchSwipes(int)(int swipes)` Sets the maximum number of scrolls allowed when performing a scroll action in search of a child element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#setSwipeDeadZonePercentage(double)(double swipeDeadZonePercentage)` Sets the percentage of a widget's size that's considered as no-touch zone when swiping. |

| ### Protected methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#exists(androidx.test.uiautomator.UiSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector selector)` Used privately when performing swipe searches to decide if an element has become visible or not. |

| ### Inherited Constants |
|---|
| From [androidx.test.uiautomator.UiObject](https://developer.android.com/reference/androidx/test/uiautomator/UiObject) |---|---| | `static final int` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#FINGER_TOUCH_HALF_WIDTH() = 20` | | `static final int` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#SWIPE_MARGIN_LIMIT() = 5` | | `static final long` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#WAIT_FOR_EVENT_TMEOUT() = 3000` **This field is deprecated.** use `https://developer.android.com/reference/androidx/test/uiautomator/Configurator#setScrollAcknowledgmentTimeout(long)` <br /> | | `static final long` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#WAIT_FOR_SELECTOR_POLL() = 1000` | | `static final long` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#WAIT_FOR_SELECTOR_TIMEOUT() = 10000` **This field is deprecated.** use `https://developer.android.com/reference/androidx/test/uiautomator/Configurator#setWaitForSelectorTimeout(long)` <br /> | | `static final long` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#WAIT_FOR_WINDOW_TMEOUT() = 5500` | |

| ### Inherited methods |
|---|
| From [androidx.test.uiautomator.UiCollection](https://developer.android.com/reference/androidx/test/uiautomator/UiCollection) |---|---| | `int` | `https://developer.android.com/reference/androidx/test/uiautomator/UiCollection#getChildCount(androidx.test.uiautomator.UiSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern)` Counts child UI element instances matching the `childPattern` argument. | |
| From [androidx.test.uiautomator.UiObject](https://developer.android.com/reference/androidx/test/uiautomator/UiObject) |---|---| | `void` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#clearTextField()()` Clears the existing text contents in an editable field. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#click()()` Performs a click at the center of the visible bounds of the UI element represented by this UiObject. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#clickAndWaitForNewWindow()()` Waits for window transitions that would typically take longer than the usual default timeouts. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#clickAndWaitForNewWindow(long)(long timeout)` Performs a click at the center of the visible bounds of the UI element represented by this UiObject and waits for window transitions. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#clickBottomRight()()` Clicks the bottom and right corner of the UI element | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#clickTopLeft()()` Clicks the top and left corner of the UI element | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#dragTo(androidx.test.uiautomator.UiObject,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject destObj, int steps)` Drags this object to a destination UiObject. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#dragTo(int,int,int)(int destX, int destY, int steps)` Drags this object to arbitrary coordinates. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#exists()()` Check if view exists. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#findAccessibilityNodeInfo(long)(long timeout)` Finds a matching UI element in the accessibility hierarchy, by using the selector for this UiObject. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getBounds()()` Returns the view's `bounds` property. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getChild(androidx.test.uiautomator.UiSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector selector)` Creates a new UiObject for a child view that is under the present UiObject. | | `int` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getChildCount()()` Counts the child views immediately under the present UiObject. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getClassName()()` Retrieves the `className` property of the UI element. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getContentDescription()()` Reads the `content_desc` property of the UI element | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getFromParent(androidx.test.uiautomator.UiSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector selector)` Creates a new UiObject for a sibling view or a child of the sibling view, relative to the present UiObject. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getPackageName()()` Reads the view's `package` property | | `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getSelector()()` Debugging helper. | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getText()()` Reads the `text` property of the UI element | | `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#getVisibleBounds()()` Returns the visible bounds of the view. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isCheckable()()` Checks if the UI element's `checkable` property is currently true. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isChecked()()` Check if the UI element's `checked` property is currently true | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isClickable()()` Checks if the UI element's `clickable` property is currently true. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isEnabled()()` Checks if the UI element's `enabled` property is currently true. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isFocusable()()` Check if the UI element's `focusable` property is currently true. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isFocused()()` Check if the UI element's `focused` property is currently true | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isLongClickable()()` Check if the view's `long-clickable` property is currently true | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isScrollable()()` Check if the view's `scrollable` property is currently true | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#isSelected()()` Checks if the UI element's `selected` property is currently true. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#longClick()()` Long clicks the center of the visible bounds of the UI element | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#longClickBottomRight()()` Long clicks bottom and right corner of the UI element | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#longClickTopLeft()()` Long clicks on the top and left corner of the UI element | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#performMultiPointerGesture(android.view.MotionEvent.PointerCoords[]...)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html MotionEvent.PointerCoords[][] touches )` Performs a multi-touch gesture. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#performTwoPointerGesture(android.graphics.Point,android.graphics.Point,android.graphics.Point,android.graphics.Point,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Point.html startPoint1, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Point.html startPoint2, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Point.html endPoint1, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Point.html endPoint2, int steps )` Generates a two-pointer gesture with arbitrary starting and ending points. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#pinchIn(int,int)(int percent, int steps)` Performs a two-pointer gesture, where each pointer moves diagonally toward the other, from the edges to the center of this UiObject . | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#pinchOut(int,int)(int percent, int steps)` Performs a two-pointer gesture, where each pointer moves diagonally opposite across the other, from the center out towards the edges of the this UiObject. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#setText(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html text)` Sets the text in an editable field, after clearing the field's content. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#swipeDown(int)(int steps)` Performs the swipe down action on the UiObject. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#swipeLeft(int)(int steps)` Performs the swipe left action on the UiObject. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#swipeRight(int)(int steps)` Performs the swipe right action on the UiObject. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#swipeUp(int)(int steps)` Performs the swipe up action on the UiObject. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#waitForExists(long)(long timeout)` Waits a specified length of time for a view to become visible. | | `boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject#waitUntilGone(long)(long timeout)` Waits a specified length of time for a view to become undetectable. | |

## Public constructors

### UiScrollable

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public UiScrollable(@NonNull UiSelector container)
```

Constructor.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector container` | a `https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` selector to identify the scrollable layout element. |

## Public methods

### flingBackward

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean flingBackward()
```

Performs a backwards fling action with the default number of fling steps (5). If the swipe direction is set to vertical, then the swipe will be performed from top to bottom. If the swipe direction is set to horizontal, then the swipes will be performed from left to right. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Returns |
|---|---|
| `boolean` | true if scrolled, and false if can't scroll anymore |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### flingForward

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean flingForward()
```

Performs a forward fling with the default number of fling steps (5). If the swipe direction is set to vertical, then the swipes will be performed from bottom to top. If the swipe direction is set to horizontal, then the swipes will be performed from right to left. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Returns |
|---|---|
| `boolean` | true if scrolled, false if can't scroll anymore |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### flingToBeginning

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean flingToBeginning(int maxSwipes)
```

Performs a fling gesture to reach the beginning of a scrollable layout element. The beginning can be at the top-most edge in the case of vertical controls, or the left-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int maxSwipes` | maximum number of flings allowed |

| Returns |
|---|---|
| `boolean` | true if beginning reached within maxSwipes |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### flingToEnd

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean flingToEnd(int maxSwipes)
```

Performs a fling gesture to reach the end of a scrollable layout element. The end can be at the bottom-most edge in the case of vertical controls, or the right-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int maxSwipes` | maximum number of flings allowed |

| Returns |
|---|---|
| `boolean` | true if end reached within maxSwipes |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### getChildByDescription

```
public @NonNull UiObject getChildByDescription(
    @NonNull UiSelector childPattern,
    @NonNull String text
)
```

Searches for a child element in the present scrollable container. The search first looks for a child element that matches the selector you provided, then looks for the content-description in its children elements. If both search conditions are fulfilled, the method returns a `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the element matching the selector (not the child element in its subhierarchy containing the content-description). By default, this method performs a scroll search. See `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByDescription(androidx.test.uiautomator.UiSelector,java.lang.String,boolean)`

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern` | `https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` for a child in a scollable layout element |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text` | Content-description to find in the children of the `childPattern` match |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the child element that matches the search conditions |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### getChildByDescription

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public @NonNull UiObject getChildByDescription(
    @NonNull UiSelector childPattern,
    @NonNull String text,
    boolean allowScrollSearch
)
```

Searches for a child element in the present scrollable container. The search first looks for a child element that matches the selector you provided, then looks for the content-description in its children elements. If both search conditions are fulfilled, the method returns a `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the element matching the selector (not the child element in its subhierarchy containing the content-description).

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern` | `https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` for a child in a scollable layout element |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text` | Content-description to find in the children of the `childPattern` match (may be a partial match) |
| `boolean allowScrollSearch` | set to true if scrolling is allowed |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the child element that matches the search conditions |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### getChildByInstance

```
public @NonNull UiObject getChildByInstance(@NonNull UiSelector childPattern, int instance)
```

Searches for a child element in the present scrollable container that matches the selector you provided. The search is performed without scrolling and only on visible elements.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern` | `https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` for a child in a scollable layout element |
| `int instance` | int number representing the occurance of a `childPattern` match |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the child element that matches the search conditions |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### getChildByText

```
public @NonNull UiObject getChildByText(@NonNull UiSelector childPattern, @NonNull String text)
```

Searches for a child element in the present scrollable container. The search first looks for a child element that matches the selector you provided, then looks for the text in its children elements. If both search conditions are fulfilled, the method returns a `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the element matching the selector (not the child element in its subhierarchy containing the text). By default, this method performs a scroll search. See `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByText(androidx.test.uiautomator.UiSelector,java.lang.String,boolean)`

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern` | `https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` selector for a child in a scrollable layout element |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text` | String to find in the children of the `childPattern` match |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the child element that matches the search conditions |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### getChildByText

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public @NonNull UiObject getChildByText(
    @NonNull UiSelector childPattern,
    @NonNull String text,
    boolean allowScrollSearch
)
```

Searches for a child element in the present scrollable container. The search first looks for a child element that matches the selector you provided, then looks for the text in its children elements. If both search conditions are fulfilled, the method returns a `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the element matching the selector (not the child element in its subhierarchy containing the text).

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector childPattern` | `https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` selector for a child in a scrollable layout element |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text` | String to find in the children of the `childPattern` match |
| `boolean allowScrollSearch` | set to true if scrolling is allowed |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` representing the child element that matches the search conditions |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### getMaxSearchSwipes

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public int getMaxSearchSwipes()
```

Gets the maximum number of scrolls allowed when performing a scroll action in search of a child element. See `https://developer.android.com/reference/androidx/test/uiautomator/UiCollection#getChildByDescription(androidx.test.uiautomator.UiSelector,java.lang.String)` and `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByText(androidx.test.uiautomator.UiSelector,java.lang.String)`.

| Returns |
|---|---|
| `int` | max the number of search swipes to perform until giving up |

### getSwipeDeadZonePercentage

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public double getSwipeDeadZonePercentage()
```

Returns the percentage of a widget's size that's considered as a no-touch zone when swiping. The no-touch zone is set as a percentage of a widget's total width or height, denoting a margin around the swipable area of the widget. Swipes must start and end inside this margin. This is important when the widget being swiped may not respond to the swipe if started at a point too near to the edge. The default is 10% from either edge.

| Returns |
|---|---|
| `double` | a value between 0 and 1 |

### scrollBackward

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollBackward()
```

Performs a backward scroll with the default number of scroll steps (55). If the swipe direction is set to vertical, then the swipes will be performed from top to bottom. If the swipe direction is set to horizontal, then the swipes will be performed from left to right. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Returns |
|---|---|
| `boolean` | true if scrolled, and false if can't scroll anymore |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollBackward

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollBackward(int steps)
```

Performs a backward scroll. If the swipe direction is set to vertical, then the swipes will be performed from top to bottom. If the swipe direction is set to horizontal, then the swipes will be performed from left to right. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int steps` | number of steps. Use this to control the speed of the scroll action. |

| Returns |
|---|---|
| `boolean` | true if scrolled, false if can't scroll anymore |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollDescriptionIntoView

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollDescriptionIntoView(@NonNull String text)
```

Performs a forward scroll action on the scrollable layout element until the content-description is found, or until swipe attempts have been exhausted. See `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#setMaxSearchSwipes(int)`

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text` | content-description to find within the contents of this scrollable layout element. |

| Returns |
|---|---|
| `boolean` | true if item is found; else, false |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollForward

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollForward()
```

Performs a forward scroll with the default number of scroll steps (55). If the swipe direction is set to vertical, then the swipes will be performed from bottom to top. If the swipe direction is set to horizontal, then the swipes will be performed from right to left. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Returns |
|---|---|
| `boolean` | true if scrolled, false if can't scroll anymore |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollForward

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollForward(int steps)
```

Performs a forward scroll. If the swipe direction is set to vertical, then the swipes will be performed from bottom to top. If the swipe direction is set to horizontal, then the swipes will be performed from right to left. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int steps` | number of steps. Use this to control the speed of the scroll action |

| Returns |
|---|---|
| `boolean` | true if scrolled, false if can't scroll anymore |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollIntoView

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollIntoView(@NonNull UiObject obj)
```

Perform a forward scroll action to move through the scrollable layout element until a visible item that matches the `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` is found.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiObject obj` | `https://developer.android.com/reference/androidx/test/uiautomator/UiObject` |

| Returns |
|---|---|
| `boolean` | true if the item was found and now is in view else false |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollIntoView

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollIntoView(@NonNull UiSelector selector)
```

Perform a scroll forward action to move through the scrollable layout element until a visible item that matches the selector is found. See `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollDescriptionIntoView(java.lang.String)` and `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#scrollTextIntoView(java.lang.String)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector selector` | `https://developer.android.com/reference/androidx/test/uiautomator/UiSelector` selector |

| Returns |
|---|---|
| `boolean` | true if the item was found and now is in view; else, false |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollTextIntoView

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollTextIntoView(@NonNull String text)
```

Performs a forward scroll action on the scrollable layout element until the text you provided is visible, or until swipe attempts have been exhausted. See `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#setMaxSearchSwipes(int)`

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text` | test to look for |

| Returns |
|---|---|
| `boolean` | true if item is found; else, false |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollToBeginning

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollToBeginning(int maxSwipes)
```

Scrolls to the beginning of a scrollable layout element. The beginning can be at the top-most edge in the case of vertical controls, or the left-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int maxSwipes` | maximum number of scrolls allowed |

| Returns |
|---|---|
| `boolean` | true if beginning reached within maxSwipes |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollToBeginning

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollToBeginning(int maxSwipes, int steps)
```

Scrolls to the beginning of a scrollable layout element. The beginning can be at the top-most edge in the case of vertical controls, or the left-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int maxSwipes` | maximum number of scrolls allowed |
| `int steps` | use steps to control the speed, so that it may be a scroll, or fling |

| Returns |
|---|---|
| `boolean` | true if beginning reached within maxSwipes |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollToEnd

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollToEnd(int maxSwipes)
```

Scrolls to the end of a scrollable layout element. The end can be at the bottom-most edge in the case of vertical controls, or the right-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int maxSwipes` | maximum number of scrolls allowed |

| Returns |
|---|---|
| `boolean` | true if end reached within maxSwipes |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### scrollToEnd

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public boolean scrollToEnd(int maxSwipes, int steps)
```

Scrolls to the end of a scrollable layout element. The end can be at the bottom-most edge in the case of vertical controls, or the right-most edge for horizontal controls. Make sure to take into account devices configured with right-to-left languages like Arabic and Hebrew.

| Parameters |
|---|---|
| `int maxSwipes` | maximum number of scrolls allowed |
| `int steps` | use steps to control the speed, so that it may be a scroll, or fling |

| Returns |
|---|---|
| `boolean` | true if end reached within maxSwipes |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObjectNotFoundException` |   |

### setAsHorizontalList

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public @NonNull UiScrollable setAsHorizontalList()
```

Set the direction of swipes to be horizontal when performing scroll actions.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | reference to itself |

### setAsVerticalList

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public @NonNull UiScrollable setAsVerticalList()
```

Set the direction of swipes to be vertical when performing scroll actions.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | reference to itself |

### setMaxSearchSwipes

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public @NonNull UiScrollable setMaxSearchSwipes(int swipes)
```

Sets the maximum number of scrolls allowed when performing a scroll action in search of a child element. See `https://developer.android.com/reference/androidx/test/uiautomator/UiCollection#getChildByDescription(androidx.test.uiautomator.UiSelector,java.lang.String)` and `https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable#getChildByText(androidx.test.uiautomator.UiSelector,java.lang.String)`.

| Parameters |
|---|---|
| `int swipes` | the number of search swipes to perform until giving up |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | reference to itself |

### setSwipeDeadZonePercentage

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
public @NonNull UiScrollable setSwipeDeadZonePercentage(double swipeDeadZonePercentage)
```

Sets the percentage of a widget's size that's considered as no-touch zone when swiping. The no-touch zone is set as percentage of a widget's total width or height, denoting a margin around the swipable area of the widget. Swipes must always start and end inside this margin. This is important when the widget being swiped may not respond to the swipe if started at a point too near to the edge. The default is 10% from either edge.

| Parameters |
|---|---|
| `double swipeDeadZonePercentage` | is a value between 0 and 1 |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable` | reference to itself |

## Protected methods

### exists

Added in [2.2.0](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.2.0)

```
protected boolean exists(@NonNull UiSelector selector)
```

Used privately when performing swipe searches to decide if an element has become visible or not.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/UiSelector selector` |   |

| Returns |
|---|---|
| `boolean` | true if found else false |