AccessibilitySnapshot

Captures every window's accessibility tree as AccessibilityElements in one pass.

Use it to query a whole screen quickly, including Compose UI, other apps, and system dialogs, then act on the result with UiAutomator. The returned list is in depth-first order.

Properties

Link copied to clipboard
const val DEFAULT_MAX_DEPTH: Int = 60

The default maximum tree depth; deeper nodes are skipped.

Functions

Link copied to clipboard
fun capture(packageName: String? = null, maxDepth: Int = DEFAULT_MAX_DEPTH, uiAutomation: UiAutomation = InstrumentationRegistry.getInstrumentation().uiAutomation): List<AccessibilityElement>

Reads the current accessibility trees.