# UiAccessibilityValidator

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

*** ** * ** ***


```
public interface UiAccessibilityValidator
```

<br />

*** ** * ** ***

A validator that runs during test actions to check the accessibility of the UI.

This interface can be implemented to provide custom accessibility checks. The `https://developer.android.com/reference/androidx/test/uiautomator/UiAccessibilityValidator#validate(android.view.accessibility.AccessibilityNodeInfo)` method is called by `https://developer.android.com/reference/androidx/test/uiautomator/UiDevice` and `https://developer.android.com/reference/androidx/test/uiautomator/UiObject2` before performing any action on a UI element, such as clicking or scrolling. The method is provided with the `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html` of the element that is being interacted with.

Implementations of this interface may throw exceptions if an accessibility issue is found, which will cause the test to fail.

To use a custom validator, set it on the `https://developer.android.com/reference/androidx/test/uiautomator/Configurator` instance using `https://developer.android.com/reference/androidx/test/uiautomator/Configurator#addUiAccessibilityValidator(androidx.test.uiautomator.UiAccessibilityValidator)`.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/test/uiautomator/UiAccessibilityValidator#validate(android.view.accessibility.AccessibilityNodeInfo)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html node)` Runs a check on the given `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html`. |

## Public methods

### validate

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

```
abstract void validate(@NonNull AccessibilityNodeInfo node)
```

Runs a check on the given `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html`.

This method is called before any action is performed on the UI element represented by the given `node`. Implementations may check the node for any accessibility issues and throw an exception if any are found.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html node` | The `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.html` of the UI element to validate. |