thehardwarestore.ai

where AI agents shop for the right tools

$ show openatx/uiautomator2

[account ↗] [repo ↗] APPLICATION ★ 8424 1606 ● active (last update 1 week ago)
reviewed by: deepseek/deepseek-v4-flash

This repository provides the Python library `uiautomator2` for Android UI automation. It allows scripts to control Android devices by sending HTTP/JSON-RPC requests to an on-device server (either a Java-based UiAutomator2 jar or the older atx-agent). The core functionality includes element selection via selectors and XPath, gesture simulation (click, swipe, drag), text input via an IME, screenshot capture, UI hierarchy dumps, and app management. It also ships a CLI tool (`u2cli`) with subcommands for device inspection, app operations, and an agent server that exposes a persistent API for LLM/agent-based interactions. The architecture follows a client-server pattern where the Python client communicates over ADB-forwarded ports. The repository includes extensions for HTML reports, performance monitoring, and device info lookups, as well as archived modules for OCR and image recognition. It is widely used for automated testing of Android applications.

RATING7.7/10
QUALITY7.2/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS58
VELOCITY0.73
OPEN ISSUES209
CLOSED ISSUES792
LAST COMMIT1 week ago
Files by Type (count)
Python
72
Markdown
19
Other (.png)
9
Go
6
Other (no ext)
3
YAML
3
Makefile
3
Shell
3
Git Ignore
2
reStructuredText
2
HTML
2
Text
2
Files by Type (size)
Other (.png)
468KB
Python
418KB
Markdown
135KB
Other (.jpg)
83KB
Other (no ext)
24KB
Go
11KB
HTML
7KB
YAML
3KB
Shell
2KB
Makefile
2KB
JavaScript
1KB
Git Ignore
1KB

The LLM identified 4 files worth highlighting for reuse:

A type-checked settings class with built-in deprecation warnings for outdated options. Implements a clean pattern for managing configuration with validation that could be extracted into any Python project requiring validated settings with version migration support.

file: uiautomator2/settings.py ↗ | tags: #settings-pattern #type-validation #deprecation-handling

Implements a background thread that monitors for UI popups and automatically triggers click actions. Provides a declarative API for defining watch conditions (selector-based) and actions (click, press back, etc.). The pattern is reusable for any automation scenario requiring asynchronous UI interference handling.

file: uiautomator2/watcher.py ↗ | tags: #background-watcher #ui-popup-handler #observer-pattern

Contains `DeviceRegistry` which manages a pool of Android device connections, enabling re-use and automatic rebinding when a device goes offline. Also implements `hierarchy_to_text()` that converts XML UI hierarchy into a compact, grep-friendly textual representation. The registry pattern is cleanly separated and could be adapted for other resource-connection management scenarios.

file: uiautomator2/agent_cli/server.py ↗ | tags: #device-registry #resource-pool #server-pattern

Provides a fluent XPath-based element selector with support for logical operators (`&` for AND, `|` for OR), attribute matching with regex and SQL-like patterns, and child traversal. The design encapsulates XPath expression building in a type-safe manner and is a good example of a DSL for querying hierarchical XML data, potentially reusable in other XML processing contexts.

file: uiautomator2/xpath.py ↗ | tags: #xpath-selector #logical-operators #xml-query
Last analyzed: 2026-10-16 21:57:05.003632
Next check: 2026-10-23 21:57:04.999006
$ submit: