--- id: uiautomator2 version: "3.7.0" license: MIT license_treatment: permissive maintenance: active --- # uiautomator2 — uiautomator for android device License: permissive · Maintenance: active · Downloads: 553.5K/mo ## What it is and what it does uiautomator2 is a Python automation framework for Android devices that bridges the gap between UiAutomator (Android's native testing framework) and Python code. It works by running an HTTP service on the Android device side and communicating with it from Python, exposing device capabilities like UI element selection, app launching, screen interaction, and device state queries through a simple Python API. The package is primarily used for test automation and app control workflows. You connect to an Android device via adb, then interact with UI elements using XPath queries, UiAutomator selectors, or direct coordinate-based actions. It supports waiting for elements, retrieving text, setting input, taking screenshots, and managing device state (screen on/off, clipboard, etc.). The framework handles the complexity of the underlying UiAutomator protocol, letting you write straightforward Python scripts for mobile testing and automation. Use it for: - Automated UI testing of Android apps by scripting interactions with UI elements and verifying app behavior. - Mobile app regression testing in CI/CD pipelines by running test suites against connected devices or emulators. - Extracting data from Android apps by automating navigation and text retrieval from UI elements. - End-to-end testing workflows that require coordinating multiple app interactions and state checks. - Device automation tasks like app installation verification, settings configuration, or repetitive user workflows. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Automates Android device interactions from Python by exposing UiAutomator capabilities through HTTP, enabling UI testing, app control, and element manipulation via XPath queries. Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive MIT license. It fills a clear need for Python-based Android automation. Install it if you need to automate Android UI testing or device interaction from Python; the main prerequisite is having a connected Android device with developer mode enabled. ## Install pip install uiautomator2 uv add uiautomator2 poetry add uiautomator2 ## Installing uiautomator2 Before you install: Low install friction with a pure-Python wheel distribution. Actively maintained with recent commits and a stable release cycle; supports Python 3.8 through 3.13. Requires a connected Android device with Developer options enabled and adb access. License in practice: MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely as long as you include the original license notice. Quickstart: pip install uiautomator2 import uiautomator2 as u2 d = u2.connect() # Connect to Android device print(d.info) # Get device information d.xpath('//*[@text="Settings"]').click() # Click element by XPath Requires a connected Android device with Developer options enabled, adb installed and configured, and Android version 4.4 or higher. Verify before relying: - Whether the package handles multiple simultaneous device connections or only one at a time. - Performance characteristics when interacting with complex UI hierarchies or large numbers of elements. - Whether network latency between the Python client and device significantly impacts automation speed. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 553.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags android automation python, ui testing android devices, android app automation, xpath element interaction android, adb automation framework, android device control python, mobile ui automation, mobile-testing, android-automation, ui-testing [View on SkillFed](https://skillfed.io/packages/uiautomator2) · [View on PyPI](https://pypi.org/project/uiautomator2/)