Snippet UiAutomator
This is the Python wrapper based on Mobly Snippet Lib for calling the AndroidX UiAutomator APIs.
Requirements
- Python 3.7+
- Android 8.0+ (SDK 26+)
Installation
pip install snippet-uiautomator
Initial Mobly Android Controller
-
Inside Mobly Test
To use in a Mobly test, the Android device needs to be initialized in the Mobly base test.
from mobly import base_test from mobly.controllers import android_device class MoblyTest(base_test.BaseTestClass): def setup_class(self): ad = self.register_controller(android_device)[0]
-
Outside Mobly Test
If not using in a Mobly test, such as when running in a Python terminal, the Android device can be initialized with its serial number.
from mobly.controllers import android_device ad = android_device.AndroidDevice('GOOG1234567890')
To learn more about Mobly, visit Getting started with Mobly.
Launch UiAutomator Service
Snippet UiAutomator supports launching as one of Mobly Android Device Service.
from snippet_uiautomator import uiautomator
ad.services.register(
uiautomator.ANDROID_SERVICE_NAME, uiautomator.UiAutomatorService
)
ad.ui(text='OK').click()
Test
Run unit tests for Python part:
pytest
Run tests for Snippet part:
cd snippet_uiautomator/android
./gradlew test
Set up pre-commit hooks, this will run some automated checks during each git
commit and possibly update some files that require changes:
pip install pre-commit
pre-commit install
API Usage
Metadata
Release files for snippet-uiautomator 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snippet-uiautomator-1.1.2.tar.gz | 2.3 MB | Without provenance | Details for snippet-uiautomator-1.1.2.tar.gz |
Release files / snippet-uiautomator-1.1.2.tar.gz
| Download URL | snippet-uiautomator-1.1.2.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5eaa53daa20e38015fc20a43624625b7681e4aa8b1947caa8fbecb3a4349101
|
|
BLAKE2b-256 checksum How to use checksums |
0bce1487a129bdf62198be5b99eb2464d2cb7c5afbfc3c7b9a345cf19d948e3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for snippet-uiautomator 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.