ElementRetriever

Helper class for interacting with view hierarchy to retrieve element values. This class provides utility methods to find and extract text from elements in the view hierarchy.

Functions

Link copied to clipboard
fun getTextByContentDescription(currentViewHierarchy: ViewHierarchyTreeNode?, contentDescription: String, index: Int = 0): String

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

Link copied to clipboard
fun getTextByResourceId(currentViewHierarchy: ViewHierarchyTreeNode?, resourceId: String, index: Int = 0): String

Gets the text content of an element identified by resource ID.

Link copied to clipboard
fun getTextByText(currentViewHierarchy: ViewHierarchyTreeNode?, text: String, index: Int = 0): String

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