getTextByContentDescription

fun getTextByContentDescription(currentViewHierarchy: ViewHierarchyTreeNode?, contentDescription: String, index: Int = 0): String

Gets the text content of an element identified by content description.

Return

The text content of the element

Parameters

contentDescription

The accessibility text to locate the element

index

The index of the element if multiple elements share the same content description (0-based)