How openatx/uiautomator2 works
Project type and purpose
• This is not a web‑app or full‑stack site but an open‑source Python client library and CLI called “uiautomator2.”
• Its purpose is to let testers and automation engineers write Python code on their computer that drives Android UiAutomator2 APIs running on a real device (or emulator).
File structure
• Top‑level modules and files:
• uiautomator2/ – the core Python package (core.py, _proto.py for JSON‑RPC, modules for input, swipe, xpath, watcher, etc.)
• __main__.py – CLI entrypoint
• examples/ – sample scripts (Python, Go, JS) showing usage patterns
• demo_tests/, mobile_tests/, tests/ – pytest‑based unit and integration tests
• docs/, README*.md – Sphinx and Markdown documentation
• uibox/ – a companion Go‑based CLI tool for health‑checking HTTP endpoints or other utilities
• CI/config: GitHub workflows, Makefile, pyproject.toml, poetry.toml
README for additional insights
• The library installs an Android‑side APK (android‑uiautomator‑server) via ADB, then uses ADB port forwarding so Python code can send HTTP JSON‑RPC calls to the server.
• It depends on adbutils for transport, Pillow or OpenCV for image screenshots, and optional modules under ext/ for HTML reports or performance data.