# UiObject

Summary:[Constants](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#constants)\|[Ctors](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#pubctors)\|[Methods](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#)  

# UiObject

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


class
UiObject
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object.html)`


``


`

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

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#)Known Direct Subclasses [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection) |-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------| | [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection) | Used to enumerate a container's UI elements for the purpose of counting, or targeting a sub elements by a child's text or description. | |

|---|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#)Known Indirect Subclasses [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable) |-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable) | UiScrollable is a[UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection)and provides support for searching for items in scrollable layout elements. | ||

<br />

*** ** * ** ***

A UiObject is a representation of a view. It is not in any way directly bound to a view as an object reference. A UiObject contains information to help it locate a matching view at runtime based on the[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)properties specified in its constructor. Once you create an instance of a UiObject, it can be reused for different views that match the selector criteria.

## Summary

|                                                                                                                                                                 ### Constants                                                                                                                                                                 ||
|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int`  | [FINGER_TOUCH_HALF_WIDTH](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#FINGER_TOUCH_HALF_WIDTH) <br />                                                                                                                                                                                           |
| `int`  | [SWIPE_MARGIN_LIMIT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#SWIPE_MARGIN_LIMIT) <br />                                                                                                                                                                                                     |
| `long` | [WAIT_FOR_EVENT_TMEOUT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_EVENT_TMEOUT) *This constant is deprecated. use[setScrollAcknowledgmentTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setScrollAcknowledgmentTimeout(long))* |
| `long` | [WAIT_FOR_SELECTOR_POLL](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_SELECTOR_POLL) <br />                                                                                                                                                                                             |
| `long` | [WAIT_FOR_SELECTOR_TIMEOUT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_SELECTOR_TIMEOUT) *This constant is deprecated. use[setWaitForSelectorTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setWaitForSelectorTimeout(long))*   |
| `long` | [WAIT_FOR_WINDOW_TMEOUT](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#WAIT_FOR_WINDOW_TMEOUT) <br />                                                                                                                                                                                             |

|                                                                                                                                                                                                                                                                         ### Public constructors                                                                                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#UiObject(android.support.test.uiautomator.UiSelector))`(`[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)` selector) ` *This constructor is deprecated. Use[findObject(UiSelector)](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice#findObject(android.support.test.uiautomator.UiSelector))instead. This version hides UiObject's dependency on UiDevice and is prone to misuse.* |

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

|                                                                                                                                                                                       ### Protected methods                                                                                                                                                                                        ||
|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html) | ` `[findAccessibilityNodeInfo](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#findAccessibilityNodeInfo(long))`(long timeout) ` Finds a matching UI element in the accessibility hierarchy, by using the selector for this UiObject. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Constants

### FINGER_TOUCH_HALF_WIDTH

```
int FINGER_TOUCH_HALF_WIDTH
```

<br />

<br />

Constant Value: 20 (0x00000014)  

### SWIPE_MARGIN_LIMIT

```
int SWIPE_MARGIN_LIMIT
```

<br />

<br />

Constant Value: 5 (0x00000005)  

### WAIT_FOR_EVENT_TMEOUT

```
long WAIT_FOR_EVENT_TMEOUT
```

<br />

**This constant is deprecated.**   
use[setScrollAcknowledgmentTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setScrollAcknowledgmentTimeout(long))

<br />

<br />

Constant Value: 3000 (0x0000000000000bb8)  

### WAIT_FOR_SELECTOR_POLL

```
long WAIT_FOR_SELECTOR_POLL
```

<br />

<br />

Constant Value: 1000 (0x00000000000003e8)  

### WAIT_FOR_SELECTOR_TIMEOUT

```
long WAIT_FOR_SELECTOR_TIMEOUT
```

<br />

**This constant is deprecated.**   
use[setWaitForSelectorTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setWaitForSelectorTimeout(long))

<br />

<br />

Constant Value: 10000 (0x0000000000002710)  

### WAIT_FOR_WINDOW_TMEOUT

```
long WAIT_FOR_WINDOW_TMEOUT
```

<br />

<br />

Constant Value: 5500 (0x000000000000157c)

## Public constructors

### UiObject

```
UiObject (UiSelector selector)
```

<br />

**This constructor is deprecated.**   
Use[findObject(UiSelector)](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice#findObject(android.support.test.uiautomator.UiSelector))instead. This version hides UiObject's dependency on UiDevice and is prone to misuse.

Constructs a UiObject to represent a view that matches the specified selector criteria.

<br />

## Public methods

### clearTextField

```
void clearTextField ()
```

Clears the existing text contents in an editable field. The[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)of this object must reference a UI element that is editable. When you call this method, the method sets focus on the editable field, selects all of its existing content, and clears it by sending a DELETE key press

<br />

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### click

```
boolean click ()
```

Performs a click at the center of the visible bounds of the UI element represented by this UiObject.

<br />

|                     Returns                     ||
|-----------|--------------------------------------|
| `boolean` | true if successful else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### clickAndWaitForNewWindow

```
boolean clickAndWaitForNewWindow ()
```

Waits for window transitions that would typically take longer than the usual default timeouts. See[clickAndWaitForNewWindow(long)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#clickAndWaitForNewWindow(long))

<br />

|                            Returns                            ||
|-----------|----------------------------------------------------|
| `boolean` | true if the event was triggered, else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### clickAndWaitForNewWindow

```
boolean clickAndWaitForNewWindow (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. This method differ from[click()](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#click())only in that this method waits for a a new window transition as a result of the click. Some examples of a window transition:
- launching a new activity
- bringing up a pop-up menu
- bringing up a dialog

|                                   Parameters                                   ||
|-----------|---------------------------------------------------------------------|
| `timeout` | `long`: timeout before giving up on waiting for a new window <br /> |

|                            Returns                            ||
|-----------|----------------------------------------------------|
| `boolean` | true if the event was triggered, else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### clickBottomRight

```
boolean clickBottomRight ()
```

Clicks the bottom and right corner of the UI element

<br />

|              Returns              ||
|-----------|------------------------|
| `boolean` | true on success <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### clickTopLeft

```
boolean clickTopLeft ()
```

Clicks the top and left corner of the UI element

<br />

|              Returns              ||
|-----------|------------------------|
| `boolean` | true on success <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### dragTo

```
boolean dragTo (UiObject destObj, 
                int steps)
```

Drags this object to a destination UiObject. The number of steps specified in your input parameter can influence the drag speed, and varying speeds may impact the results. Consider evaluating different speeds when using this method in your tests.

<br />

|                                               Parameters                                               ||
|-----------|---------------------------------------------------------------------------------------------|
| `destObj` | `UiObject`: the destination UiObject. <br />                                                |
| `steps`   | `int`: usually 40 steps. You can increase or decrease the steps to change the speed. <br /> |

|               Returns                ||
|-----------|---------------------------|
| `boolean` | true if successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### dragTo

```
boolean dragTo (int destX, 
                int destY, 
                int steps)
```

Drags this object to arbitrary coordinates. The number of steps specified in your input parameter can influence the drag speed, and varying speeds may impact the results. Consider evaluating different speeds when using this method in your tests.

<br />

|                                              Parameters                                              ||
|---------|---------------------------------------------------------------------------------------------|
| `destX` | `int`: the X-axis coordinate. <br />                                                        |
| `destY` | `int`: the Y-axis coordinate. <br />                                                        |
| `steps` | `int`: usually 40 steps. You can increase or decrease the steps to change the speed. <br /> |

|               Returns                ||
|-----------|---------------------------|
| `boolean` | true if successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### exists

```
boolean exists ()
```

Check if view exists. This methods performs a[waitForExists(long)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#waitForExists(long))with zero timeout. This basically returns immediately whether the view represented by this UiObject exists or not. If you need to wait longer for this view, then see[waitForExists(long)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#waitForExists(long)).

<br />

|                                  Returns                                   ||
|-----------|-----------------------------------------------------------------|
| `boolean` | true if the view represented by this UiObject does exist <br /> |

### getBounds

```
Rect getBounds ()
```

Returns the view's`bounds`property. See[getVisibleBounds()](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getVisibleBounds())

<br />

|                                         Returns                                         ||
|----------------------------------------------------------------------------|-------------|
| [Rect](https://developer.android.com/reference/android/graphics/Rect.html) | Rect <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### getChild

```
UiObject getChild (UiSelector selector)
```

Creates a new UiObject for a child view that is under the present UiObject.

<br />

|                        Parameters                        ||
|------------|----------------------------------------------|
| `selector` | `UiSelector`: for child view to match <br /> |

|                                                                     Returns                                                                      ||
|-----------------------------------------------------------------------------------------------|---------------------------------------------------|
| [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | a new UiObject representing the child view <br /> |

|                                                               Throws                                                               ||
|---------------------------------------------------------------------------------------------------------------------------------|---|
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |   |

### getChildCount

```
int getChildCount ()
```

Counts the child views immediately under the present UiObject.

<br />

|                 Returns                 ||
|-------|----------------------------------|
| `int` | the count of child views. <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### getClassName

```
String getClassName ()
```

Retrieves the`className`property of the UI element.

<br />

|                                                                   Returns                                                                   ||
|-------------------------------------------------------------------------|--------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String.html) | class name of the current node represented by this UiObject <br /> |

|                                                                         Throws                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------------|-----------------------|
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) | if no match was found |

### getContentDescription

```
String getContentDescription ()
```

Reads the`content_desc`property of the UI element

<br />

|                                                        Returns                                                         ||
|-------------------------------------------------------------------------|-----------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String.html) | value of node attribute "content_desc" <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### getFromParent

```
UiObject getFromParent (UiSelector selector)
```

Creates a new UiObject for a sibling view or a child of the sibling view, relative to the present UiObject.

<br />

|                                     Parameters                                      ||
|------------|-------------------------------------------------------------------------|
| `selector` | `UiSelector`: for a sibling view or children of the sibling view <br /> |

|                                                                      Returns                                                                       ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject) | a new UiObject representing the matched view <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### getPackageName

```
String getPackageName ()
```

Reads the view's`package`property

<br />

|                                                 Returns                                                  ||
|-------------------------------------------------------------------------|---------------------------------|
| [String](https://developer.android.com/reference/java/lang/String.html) | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### getSelector

```
UiSelector getSelector ()
```

Debugging helper. A test can dump the properties of a selector as a string to its logs if needed.`getSelector().toString();`

<br />

|                                                                                                   Returns                                                                                                   ||
|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) | [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) <br /> |

### getText

```
String getText ()
```

Reads the`text`property of the UI element

<br />

|                                                                   Returns                                                                   ||
|-------------------------------------------------------------------------|--------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String.html) | text value of the current node represented by this UiObject <br /> |

|                                                                           Throws                                                                            ||
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------|
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) | if no match could be found |

### getVisibleBounds

```
Rect getVisibleBounds ()
```

Returns the visible bounds of the view. If a portion of the view is visible, only the bounds of the visible portion are reported.

<br />

|                                         Returns                                         ||
|----------------------------------------------------------------------------|-------------|
| [Rect](https://developer.android.com/reference/android/graphics/Rect.html) | Rect <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

**See also:**

- [getBounds()](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getBounds())  

### isCheckable

```
boolean isCheckable ()
```

Checks if the UI element's`checkable`property is currently true.

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### isChecked

```
boolean isChecked ()
```

Check if the UI element's`checked`property is currently true

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                               Throws                                                               ||
|---------------------------------------------------------------------------------------------------------------------------------|---|
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |   |

### isClickable

```
boolean isClickable ()
```

Checks if the UI element's`clickable`property is currently true.

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### isEnabled

```
boolean isEnabled ()
```

Checks if the UI element's`enabled`property is currently true.

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### isFocusable

```
boolean isFocusable ()
```

Check if the UI element's`focusable`property is currently true.

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### isFocused

```
boolean isFocused ()
```

Check if the UI element's`focused`property is currently true

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### isLongClickable

```
boolean isLongClickable ()
```

Check if the view's`long-clickable`property is currently true

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### isScrollable

```
boolean isScrollable ()
```

Check if the view's`scrollable`property is currently true

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### isSelected

```
boolean isSelected ()
```

Checks if the UI element's`selected`property is currently true.

<br />

|                  Returns                   ||
|-----------|---------------------------------|
| `boolean` | true if it is else false <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### longClick

```
boolean longClick ()
```

Long clicks the center of the visible bounds of the UI element

<br />

|                      Returns                       ||
|-----------|-----------------------------------------|
| `boolean` | true if operation was successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### longClickBottomRight

```
boolean longClickBottomRight ()
```

Long clicks bottom and right corner of the UI element

<br />

|                      Returns                       ||
|-----------|-----------------------------------------|
| `boolean` | true if operation was successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### longClickTopLeft

```
boolean longClickTopLeft ()
```

Long clicks on the top and left corner of the UI element

<br />

|                      Returns                       ||
|-----------|-----------------------------------------|
| `boolean` | true if operation was successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### performMultiPointerGesture

```
boolean performMultiPointerGesture (PointerCoords... touches)
```

Performs a multi-touch gesture. You must specify touch coordinates for at least 2 pointers. Each pointer must have all of its touch steps defined in an array of[MotionEvent.PointerCoords](https://developer.android.com/reference/android/view/MotionEvent.PointerCoords.html). You can use this method to specify complex gestures, like circles and irregular shapes, where each pointer may take a different path. To create a single point on a pointer's touch path:`
PointerCoords p = new PointerCoords();
p.x = stepX;
p.y = stepY;
p.pressure = 1;
p.size = 1;
`

<br />

|                                                                                                                                                                                                     Parameters                                                                                                                                                                                                     ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `touches` | `PointerCoords`: represents the pointers' paths. Each[MotionEvent.PointerCoords](https://developer.android.com/reference/android/view/MotionEvent.PointerCoords.html)array represents a different pointer. Each[MotionEvent.PointerCoords](https://developer.android.com/reference/android/view/MotionEvent.PointerCoords.html)in an array element represents a touch point on a pointer's path. <br /> |

|                                                 Returns                                                 ||
|-----------|----------------------------------------------------------------------------------------------|
| `boolean` | `true`if all touch events for this gesture are injected successfully,`false`otherwise <br /> |

### performTwoPointerGesture

```
boolean performTwoPointerGesture (Point startPoint1, 
                Point startPoint2, 
                Point endPoint1, 
                Point endPoint2, 
                int steps)
```

Generates a two-pointer gesture with arbitrary starting and ending points.

<br />

|                                                                               Parameters                                                                               ||
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `startPoint1` | `Point`: start point of pointer 1 <br />                                                                                                                |
| `startPoint2` | `Point`: start point of pointer 2 <br />                                                                                                                |
| `endPoint1`   | `Point`: end point of pointer 1 <br />                                                                                                                  |
| `endPoint2`   | `Point`: end point of pointer 2 <br />                                                                                                                  |
| `steps`       | `int`: the number of steps for the gesture. Steps are injected about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete. <br /> |

|                                                 Returns                                                 ||
|-----------|----------------------------------------------------------------------------------------------|
| `boolean` | `true`if all touch events for this gesture are injected successfully,`false`otherwise <br /> |

### pinchIn

```
boolean pinchIn (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 .

<br />

|                                                                             Parameters                                                                             ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `percent` | `int`: percentage of the object's diagonal length for the pinch gesture <br />                                                                          |
| `steps`   | `int`: the number of steps for the gesture. Steps are injected about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete. <br /> |

|                                                 Returns                                                 ||
|-----------|----------------------------------------------------------------------------------------------|
| `boolean` | `true`if all touch events for this gesture are injected successfully,`false`otherwise <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### pinchOut

```
boolean pinchOut (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.

<br />

|                                                                             Parameters                                                                             ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `percent` | `int`: percentage of the object's diagonal length for the pinch gesture <br />                                                                          |
| `steps`   | `int`: the number of steps for the gesture. Steps are injected about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete. <br /> |

|                                                 Returns                                                 ||
|-----------|----------------------------------------------------------------------------------------------|
| `boolean` | `true`if all touch events for this gesture are injected successfully,`false`otherwise <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### setText

```
boolean setText (String text)
```

Sets the text in an editable field, after clearing the field's content.

The[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)selector of this object must reference a UI element that is editable.

When you call this method, the method sets focus on the editable field, clears its existing content, then injects your specified text into the field.

If you want to capture the original contents of the field, call[getText()](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#getText())first. You can then modify the text and use this method to update the field.

**Improvements:**Post API Level 19 (KitKat release), the underlying implementation is updated to a dedicated set text accessibility action, and it also now supports Unicode.

<br />

|               Parameters               ||
|--------|--------------------------------|
| `text` | `String`: string to set <br /> |

|                      Returns                      ||
|-----------|----------------------------------------|
| `boolean` | true if operation is successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### swipeDown

```
boolean swipeDown (int steps)
```

Performs the swipe down action on the UiObject. The swipe gesture can be performed over any surface. The targeted UI element does not need to be scrollable. See also:

- [scrollToBeginning(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToBeginning(int))
- [scrollToEnd(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToEnd(int))
- [scrollBackward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollBackward())
- [scrollForward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollForward())

<br />

<br />

|                                                                                  Parameters                                                                                   ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `steps` | `int`: indicates the number of injected move steps into the system. Steps are injected about 5ms apart. So a 100 steps may take about 1/2 second to complete. <br /> |

|               Returns                ||
|-----------|---------------------------|
| `boolean` | true if successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### swipeLeft

```
boolean swipeLeft (int steps)
```

Performs the swipe left action on the UiObject. The swipe gesture can be performed over any surface. The targeted UI element does not need to be scrollable. See also:

- [scrollToBeginning(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToBeginning(int))
- [scrollToEnd(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToEnd(int))
- [scrollBackward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollBackward())
- [scrollForward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollForward())

<br />

<br />

|                                                                                  Parameters                                                                                   ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `steps` | `int`: indicates the number of injected move steps into the system. Steps are injected about 5ms apart. So a 100 steps may take about 1/2 second to complete. <br /> |

|               Returns                ||
|-----------|---------------------------|
| `boolean` | true if successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### swipeRight

```
boolean swipeRight (int steps)
```

Performs the swipe right action on the UiObject. The swipe gesture can be performed over any surface. The targeted UI element does not need to be scrollable. See also:

- [scrollToBeginning(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToBeginning(int))
- [scrollToEnd(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToEnd(int))
- [scrollBackward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollBackward())
- [scrollForward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollForward())

<br />

<br />

|                                                                                  Parameters                                                                                   ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `steps` | `int`: indicates the number of injected move steps into the system. Steps are injected about 5ms apart. So a 100 steps may take about 1/2 second to complete. <br /> |

|               Returns                ||
|-----------|---------------------------|
| `boolean` | true if successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### swipeUp

```
boolean swipeUp (int steps)
```

Performs the swipe up action on the UiObject. See also:

- [scrollToBeginning(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToBeginning(int))
- [scrollToEnd(int)](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollToEnd(int))
- [scrollBackward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollBackward())
- [scrollForward()](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable#scrollForward())

<br />

<br />

|                                                                                  Parameters                                                                                   ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `steps` | `int`: indicates the number of injected move steps into the system. Steps are injected about 5ms apart. So a 100 steps may take about 1/2 second to complete. <br /> |

|               Returns                ||
|-----------|---------------------------|
| `boolean` | true of successful <br /> |

|                                                                           Throws                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------|
|                                                                                                                                 | UiObjectNotFoundException |
| [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException) |                           |

### waitForExists

```
boolean waitForExists (long timeout)
```

Waits a specified length of time for a view to become visible. This method waits until the view becomes visible on the display, or until the timeout has elapsed. You can use this method in situations where the content that you want to select is not immediately displayed.

<br />

|                               Parameters                               ||
|-----------|-------------------------------------------------------------|
| `timeout` | `long`: the amount of time to wait (in milliseconds) <br /> |

|                                           Returns                                            ||
|-----------|-----------------------------------------------------------------------------------|
| `boolean` | true if the view is displayed, else false if timeout elapsed while waiting <br /> |

### waitUntilGone

```
boolean waitUntilGone (long timeout)
```

Waits a specified length of time for a view to become undetectable. This method waits until a view is no longer matchable, or until the timeout has elapsed. A view becomes undetectable when the[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)of the object is unable to find a match because the element has either changed its state or is no longer displayed. You can use this method when attempting to wait for some long operation to compete, such as downloading a large file or connecting to a remote server.

<br />

|                        Parameters                        ||
|-----------|-----------------------------------------------|
| `timeout` | `long`: time to wait (in milliseconds) <br /> |

|                                                                  Returns                                                                   ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | true if the element is gone before timeout elapsed, else false if timeout elapsed but a matching element is still found. <br /> |

## Protected methods

### findAccessibilityNodeInfo

```
AccessibilityNodeInfo findAccessibilityNodeInfo (long timeout)
```

Finds a matching UI element in the accessibility hierarchy, by using the selector for this UiObject.

<br />

|                Parameters                 ||
|-----------|--------------------------------|
| `timeout` | `long`: in milliseconds <br /> |

|                                                                                 Returns                                                                                 ||
|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------|
| [AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html) | AccessibilityNodeInfo if found else null <br /> |

-

  ## Interfaces

  - [IAutomationSupport](https://developer.android.com/reference/android/support/test/uiautomator/IAutomationSupport)
  - [UiWatcher](https://developer.android.com/reference/android/support/test/uiautomator/UiWatcher)
-

  ## Classes

  - [By](https://developer.android.com/reference/android/support/test/uiautomator/By)
  - [BySelector](https://developer.android.com/reference/android/support/test/uiautomator/BySelector)
  - [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)
  - [EventCondition](https://developer.android.com/reference/android/support/test/uiautomator/EventCondition)
  - [SearchCondition](https://developer.android.com/reference/android/support/test/uiautomator/SearchCondition)
  - [UiAutomatorInstrumentationTestRunner](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorInstrumentationTestRunner)
  - [UiAutomatorTestCase](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase)
  - [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection)
  - [UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice)
  - [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)
  - [UiObject2](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2)
  - [UiObject2Condition](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2Condition)
  - [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable)
  - [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)
  - [Until](https://developer.android.com/reference/android/support/test/uiautomator/Until)
-

  ## Enums

  - [Direction](https://developer.android.com/reference/android/support/test/uiautomator/Direction)
-

  ## Exceptions

  - [StaleObjectException](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException)
  - [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException)