UiAccessibilityValidator


public interface UiAccessibilityValidator


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 validate method is called by UiDevice and UiObject2 before performing any action on a UI element, such as clicking or scrolling. The method is provided with the AccessibilityNodeInfo 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 Configurator instance using addUiAccessibilityValidator.

Summary

Public methods

abstract void

Runs a check on the given AccessibilityNodeInfo.

Public methods

validate

Added in 2.4.0-alpha07
abstract void validate(@NonNull AccessibilityNodeInfo node)

Runs a check on the given AccessibilityNodeInfo.

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
@NonNull AccessibilityNodeInfo node

The AccessibilityNodeInfo of the UI element to validate.