Overview
Node operations allow you to find and interact with UI elements (nodes) in the accessibility tree. These methods provide various search strategies to locate elements by content description, view ID, text, class name, and more.Finding and Clicking Elements
Click by Content Description
Find and click an element by its content description (accessibility label).The content description text to search for (case-insensitive, partial match)
This method searches recursively through the entire UI tree and clicks the first clickable element whose content description contains the specified text.
Click by View ID
Click element(s) by their Android resource ID.The full resource ID (e.g., “com.example.app:id/button_submit”)
true if at least one element was clicked, false otherwiseBy default, this method clicks up to the first 3 elements with the specified view ID, with 120ms delay between clicks. This prevents duplicate clicks on the same element.
Advanced View ID Methods
Click Multiple View IDs (Fallback)Click by Text Label
Find and click an element by its exact text content.The exact text label to search for (case-sensitive)
Click by Content Description (Collection)
Click the first element with an exact content description match.The exact content description to match
Advanced Node Finding
Find by Class Name and Index
Find a node by its class name and position in the tree.The fully qualified class name (e.g., “android.widget.Button”)
Zero-based index of the element (in pre-order traversal)
The found node, or
null if not foundFind by Class, Index, and String
Find a node matching class name, sibling index, and optional text content.The root node to start searching from
The fully qualified class name to match
The target index among siblings (relative position in parent). Use
-1 to ignore index.Optional text/contentDescription that the node should contain. Use
null to ignore.The first matching node, or
null if not foundClicking Mechanisms
Perform Node Click
Attempt to click a node by traversing up to find a clickable parent.The node to click (or its nearest clickable parent)
Click at Approximate Coordinates
Click any clickable element near specific coordinates.The X coordinate in pixels
The Y coordinate in pixels
Search radius in pixels
true if a clickable element was found and clicked, false otherwiseText Input Operations
Type in First Editable Field
Find the first editable text field and enter text.The text to enter into the field
This method uses breadth-first search to find the first
EditText that supports ACTION_SET_TEXT. The field is focused before text is entered.Type in Second Editable Field
Find the second editable text field and enter text.The text to enter into the second field
Type in Third Editable Field
Type by Resource ID
Enter text into a field identified by its resource ID.The full resource ID of the input field
The text to enter
Type by Class Name
Enter text into all fields matching a class name.The class name to match (e.g., “android.widget.EditText”)
The text to enter into matching fields
Text Extraction
Get All Text from Screen
Extract all visible text from the current screen.Concatenated text from all text nodes and content descriptions on screen
Check if Text is Present
Check if specific text exists anywhere on screen.The text to search for (case-insensitive, partial match)
true if the text is found in any node’s text or content descriptionGet Content Description
Get the content description of a node containing specific text.The substring to search for in node text or content description
The full content description of the found node, or
null if not foundKeyboard Actions
Press Enter Key
Simulate pressing the Enter/Return key.This method tries three strategies in order:
- Find and click a visible Enter/Done/Send button
- Send
ACTION_IME_ENTERto the focused field (API 33+) - Tap at the typical Enter key position as fallback
Deletion Operations
Delete by Resource ID
Clear text from a field identified by resource ID.The resource ID of the field to clear
Delete by Class Name
Clear text from all fields matching a class name.The class name of fields to clear
Specialized Click Methods
Click Element by Area
Click an element based on its pixel area (width × height).The target area in square pixels
Click Element by Area Range
Click an element whose area falls within a range.Minimum area in square pixels
Maximum area in square pixels
App-Specific Methods
These methods are designed for specific apps but demonstrate advanced techniques:Click First Gallery Item
Clicks the first thumbnail in a TikTok-style gallery view.Click Video Upload Button
Finds and clicks the video upload button using multiple fallback strategies.Click First Song
Clicks the first item in a RecyclerView (music list).Click Bio Button
Clicks a button whose content description starts with “Bio”.Find Toggle Near Text
Finds a toggle element (switch, checkbox) near text containing specific keywords.Best Practices
Use the most specific search method available (View ID > Content Description > Text)
Always check for null results when using find methods
Add small delays between text input and clicking to allow UI to update
For production automation, prefer content descriptions over text as they’re more stable across localizations