# Searchable

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

*** ** * ** ***


```
public interface Searchable
```

<br />

Known direct subclasses [UiDevice](https://developer.android.com/reference/androidx/test/uiautomator/UiDevice), [UiObject2](https://developer.android.com/reference/androidx/test/uiautomator/UiObject2), [UiWindow](https://developer.android.com/reference/androidx/test/uiautomator/UiWindow)

|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/UiDevice` | UiDevice provides access to state information about the device. |
| `https://developer.android.com/reference/androidx/test/uiautomator/UiObject2` | Represents a UI element, and exposes methods for performing gestures (clicks, swipes) or searching through its children. |
| `https://developer.android.com/reference/androidx/test/uiautomator/UiWindow` | Represents a UI window on the screen and provides methods to access its properties and perform actions. |

*** ** * ** ***

The Searchable interface represents an object that can be searched for matching UI elements.

## Summary

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/androidx/test/uiautomator/UiObject2` | `https://developer.android.com/reference/androidx/test/uiautomator/Searchable#findObject(androidx.test.uiautomator.BySelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/BySelector selector)` Returns the first object to match the `selector` criteria. |
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/test/uiautomator/UiObject2>` | `https://developer.android.com/reference/androidx/test/uiautomator/Searchable#findObjects(androidx.test.uiautomator.BySelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/BySelector selector)` Returns all objects that match the `selector` criteria. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/Searchable#hasObject(androidx.test.uiautomator.BySelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/test/uiautomator/BySelector selector)` Returns whether there is a match for the given `selector` criteria. |

## Public methods

### findObject

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

```
abstract UiObject2 findObject(@NonNull BySelector selector)
```

Returns the first object to match the `selector` criteria.

### findObjects

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

```
abstract @NonNull List<UiObject2> findObjects(@NonNull BySelector selector)
```

Returns all objects that match the `selector` criteria.

### hasObject

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

```
abstract boolean hasObject(@NonNull BySelector selector)
```

Returns whether there is a match for the given `selector` criteria.