# ScopedUiWatcher

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/watcher/Watcher.kt+class:androidx.test.uiautomator.watcher.ScopedUiWatcher) Added in [2.4.1](https://developer.android.com/jetpack/androidx/releases/test-uiautomator#2.4.1)

*** ** * ** ***


```
public interface ScopedUiWatcher<T extends Object>
```

<br />

Known direct subclasses [PermissionDialog](https://developer.android.com/reference/androidx/test/uiautomator/watcher/PermissionDialog)

|---|---|
| `https://developer.android.com/reference/androidx/test/uiautomator/watcher/PermissionDialog` | Allows easy interaction with the permission dialog. |

*** ** * ** ***

Defines a contract for a watcher with a scope. A watcher determines whether a certain UI condition is satisfied and allows to operate on the UI. It can be registered with `https://developer.android.com/reference/androidx/test/uiautomator/UiAutomatorTestScope#watchFor(androidx.test.uiautomator.watcher.ScopedUiWatcher,kotlin.Function1)`. `https://developer.android.com/reference/androidx/test/uiautomator/watcher/ScopedUiWatcher`s registered in a `https://developer.android.com/reference/androidx/test/uiautomator/UiAutomatorTestScope` are automatically unregistered at the end of the scope.

## Summary

| ### Public methods |
|---|---|
| `abstract boolean` | `https://developer.android.com/reference/androidx/test/uiautomator/watcher/ScopedUiWatcher#isVisible()()` Whether the dialog is visible. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull T` | `https://developer.android.com/reference/androidx/test/uiautomator/watcher/ScopedUiWatcher#scope()()` A scope for interacting with the dialog. |

## Public methods

### isVisible

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

```
abstract boolean isVisible()
```

Whether the dialog is visible.

### scope

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

```
abstract @NonNull T scope()
```

A scope for interacting with the dialog.