UI Interaction Tools
tap_by_index(index: int) -> str
Tap on a UI element by its index from cached elements. Must call
get_state()
first.
swipe(start_x: int, start_y: int, end_x: int, end_y: int, duration_ms: int = 300) -> bool
Perform swipe gesture. For long press, use same start/end coordinates with longer duration.
input_text(text: str) -> str
Input text into focused element. Supports special characters and non-ASCII text.
press_key(keycode: int) -> str
Press Android keys using keycodes. Common: HOME (3), BACK (4), ENTER (66), DELETE (67).
back() -> str
Convenience method to press the Android back button.
App Management Tools
start_app(package: str, activity: str = "") -> str
Start application by package name and optional activity.
list_packages(include_system_apps: bool = False) -> List[str]
List installed packages. Optionally include system apps.
install_app(apk_path: str, reinstall: bool = False, grant_permissions: bool = True) -> str
Install APK file with optional reinstall and permission granting.
State Analysis Tools
get_state(serial: Optional[str] = None) -> Dict[str, Any]
Get comprehensive device state including accessibility tree and phone state. Caches UI elements.
take_screenshot() -> Tuple[str, bytes]
Capture device screen and return format and image data. Stores screenshots for GIF creation.
Quick Reference
Function | Purpose | Returns |
---|---|---|
tap_by_index(index) | Tap UI element by index | Status message |
swipe(x1, y1, x2, y2, duration) | Swipe gesture | Success boolean |
input_text(text) | Type text | Status message |
press_key(keycode) | Press Android key | Status message |
back() | Press back button | Status message |
start_app(package, activity) | Launch application | Status message |
list_packages(include_system) | List installed apps | Package list |
install_app(path, reinstall, permissions) | Install APK | Status message |
get_state(serial) | Get device state | State dictionary |
take_screenshot() | Capture screen | Format and image data |
remember(info) | Store information | Confirmation message |
get_memory() | Retrieve stored info | Memory list |
complete(success, reason) | Finish task | None |