Overview
ClawScript provides a comprehensive set of functions for automating UI interactions on Android. These functions simulate touch gestures, keyboard input, and screen navigation.All UI automation functions require Android Accessibility Service to be enabled. See Accessibility Service Setup.
Click & Tap Functions
simulateClick()
Simulates a tap at specific screen coordinates.number
required
X coordinate in pixels from left edge of screen.
number
required
Y coordinate in pixels from top edge of screen.
doubleClick()
Performs a double-tap gesture at specified coordinates.number
required
X coordinate in pixels.
number
required
Y coordinate in pixels.
longPress()
Performs a long press (press and hold) gesture.number
required
X coordinate in pixels.
number
required
Y coordinate in pixels.
Content-Based Clicking
clickNodesByContentDescription()
Clicks elements by their accessibility content description.string
required
Content description text to match (e.g., “Share”, “Like”, “Next”).
Typing & Text Input
simulateTypeInFirstEditableField()
Enters text in the first editable field on screen.string
required
Text to type into the field.
simulateTypeInSecondEditableField()
Enters text in the second editable field on screen.string
required
Text to type into the field.
simulateType()
Types text in a field identified by View ID.string
required
Android View ID of the target field.
string
required
Text to type.
simulateTypeByClass()
Types text in a field by its class name.string
required
Android class name (e.g., “android.widget.EditText”).
string
required
Text to type.
pressEnterKey()
Simulates pressing the Enter/Return key.Swipe & Scroll Functions
swipeUp()
Simulates an upward swipe gesture (scrolling down the page).swipeDown()
Simulates a downward swipe gesture (scrolling up the page).swipeLeft()
Simulates a left swipe gesture.swipeRight()
Simulates a right swipe gesture.simulateScrollToBottom()
Scrolls to the bottom of a scrollable view.simulateScrollToTop()
Scrolls to the top of a scrollable view.View ID Interactions
clickElementByViewId()
Clicks an element by its Android View ID.string
required
Full View ID (e.g., “com.instagram.android:id/profile_tab”).
Complete Workflow Examples
Screen Detection
isTextPresentOnScreen()
Checks if specific text is visible on screen using AI vision.string
required
Text or description to search for.
boolean
Returns
true if text is found, false otherwise.Best Practices
Always add delays after interactions
Always add delays after interactions
UI elements need time to respond. Add 500-1500ms delays after every action.
Use content descriptions over coordinates
Use content descriptions over coordinates
Content description clicks are more reliable across devices.
Verify state before actions
Verify state before actions
Check screen state before performing actions.
Handle errors gracefully
Handle errors gracefully
Wrap UI automation in try-catch blocks.
Limitations
Related Functions
- delay() - Essential for timing UI interactions
- speakText() - Announce automation steps
- magicClicker() - AI-powered element detection
- magicScraper() - Extract screen information