findTapTarget
fun findTapTarget(elements: List<AccessibilityElement>, predicate: (AccessibilityElement) -> Boolean): AccessibilityElement?(source)
Returns the element to tap for the single element matching predicate.
Prefers the match itself when it is clickable, then its nearest clickable ancestor, and falls back to the match. Compose often splits a button into sibling semantics nodes where the one carrying the text is not the clickable one, so tapping the raw match can miss.
Return
The element to tap, or null when no element or more than one element matches.
Parameters
elements
A snapshot from AccessibilitySnapshot.capture.
predicate
Selects the element, for example { it.matches(text = "Save") }.