HA4T 🐍
HA4T (Hybrid App For Testing Tool) 是一个跨平台的UI自动化框架,适用于混合型app、web和原生app等。该框架基于airtest aircv模块、飞浆OCR、WS、uiautomator2和facebook_wda进行开发。 (目前仅个人开发和使用,可能存在一些问题~)
特性
- 跨平台支持:适用于iOS、Android和Web应用
- 多种定位方式:支持图像识别、OCR文字识别、webview定位、原生控件定位等
- 灵活的操作API:提供点击、滑动、输入等常用操作
安装
使用pip安装HA4T:
pip install ha4t
快速开始
以下是一个简单的示例,展示如何使用HA4T进行基本操作:
# 原生定位
from ha4t import connect
from ha4t.api import *
connect(platform="android")
# 启动应用
start_app(activity="com.xxx.xxx.MainActivity", app_name="com.xxx.xxx")
# 等待
wait(text="添加新项目", timeout=30)
# orc 文字识别定位 中/英
click("添加新项目")
# 图像匹配定位
click(image="./添加新项目.png")
from ha4t.aircv.cv import Template
click(Template("./添加新项目.png"))
# u2 元素定位
click(text="添加新项目")
# webview 定位
from ha4t.cdp.cdp import CDP
from ha4t.cdp.server import CdpServer
from ha4t.cdp.by import By
cdp_server = CdpServer()
cdp_server.start_server_for_android_app(device.driver.adb_device)
cdp = CDP(cdp_server.ws_endpoint)
window = cdp.get_page(["homePage"])
time.sleep(3)
window.click((By.TEXT, "新建项目"))
详细文档(未完善)
查看详细文档以获取更多信息,包括:
- 完整的API参考
- 高级用法指南
- 最佳实践和技巧
问题和支持
如果您遇到任何问题或需要支持,请提交一个issue。
许可证
本项目采用MIT许可证。详情请见LICENSE文件。
致谢
HA4T 的开发得益于以下开源项目:
- airtest
- uiautomator2
- facebook-wda
- paddleocr
- ios-webkit-debug-proxy
- ui-viewer (MIT License) — 编辑器模块基于此项目二次开发
如果您觉得HA4T对您有帮助,请考虑给项目一个星标 ⭐️
Metadata
Release files for HA4T 0.1.6
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 |
|---|---|---|---|---|
| ha4t-0.1.6.tar.gz | 21.7 MB | Without provenance | Details for ha4t-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ha4t-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for ha4t-0.1.6-py3-none-any.whl |
Total release size: 43.6 MB
Release files / ha4t-0.1.6.tar.gz
| Download URL | ha4t-0.1.6.tar.gz |
|---|---|
| Size | 21.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
122d3a997f0815d02914326a820fdfc802bbd36eb6c2756925182412e5823096
|
|
BLAKE2b-256 checksum How to use checksums |
8889634ad6888a7bf04eb83af3be61cde9cda0eb27898d1c1d1c5e0c1efeabac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / ha4t-0.1.6-py3-none-any.whl
| Download URL | ha4t-0.1.6-py3-none-any.whl |
|---|---|
| Size | 21.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c81031b1152004e23b7a1cfa637c81702650afe5b49ba543a244d372170bf20
|
|
BLAKE2b-256 checksum How to use checksums |
e61ce710ab3871d5d6c1178336103ceb69a30f98b59fdb4bc4a202c7dc1cd3ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for HA4T 0.1.6
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.