# 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)

*** ** * ** ***


```
interface ScopedUiWatcher<T : Any?>
```

<br />

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

|---|---|
| `https://developer.android.com/reference/kotlin/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/kotlin/androidx/test/uiautomator/UiAutomatorTestScope#watchFor(androidx.test.uiautomator.watcher.ScopedUiWatcher,kotlin.Function1)`. `https://developer.android.com/reference/kotlin/androidx/test/uiautomator/watcher/ScopedUiWatcher`s registered in a `https://developer.android.com/reference/kotlin/androidx/test/uiautomator/UiAutomatorTestScope` are automatically unregistered at the end of the scope.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/uiautomator/watcher/ScopedUiWatcher#isVisible()()` Whether the dialog is visible. |
| `T` | `https://developer.android.com/reference/kotlin/androidx/test/uiautomator/watcher/ScopedUiWatcher#scope()()` A scope for interacting with the dialog. |

## Public functions

### isVisible

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

```
fun isVisible(): Boolean
```

Whether the dialog is visible.

### scope

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

```
fun scope(): T
```

A scope for interacting with the dialog.