Skip to main content

跨平台的UI自动化框架,适用于混合型app

Project description

HA4T 🐍

PyPI version Documentation Status

HA4T (Hybrid App For Testing Tool) 是一个跨平台的UI自动化框架,适用于混合型app、web和原生app等。该框架基于airtest、飞浆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 的开发得益于以下开源项目:

感谢这些项目的贡献者们! 如果您觉得HA4T对您有帮助,请考虑给我们一个星标 ⭐️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ha4t-0.0.5.tar.gz (21.2 MB view details)

Uploaded Source

Built Distribution

HA4T-0.0.5-py3-none-any.whl (21.3 MB view details)

Uploaded Python 3

File details

Details for the file ha4t-0.0.5.tar.gz.

File metadata

  • Download URL: ha4t-0.0.5.tar.gz
  • Upload date:
  • Size: 21.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for ha4t-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d20fde73170a71afb7c18048d414903140361f92160019711896ef3fb20985fc
MD5 4491a37151b28c1a806d8413e8b1761e
BLAKE2b-256 6fe7cf9e0c532f588124e7304fa0e322e31303f4591978fe63ae7c2614f1201a

See more details on using hashes here.

File details

Details for the file HA4T-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: HA4T-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 21.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for HA4T-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 033b38984e8571030a55da2759719c2f6ad67a6b697129f3fbe7bd5b3e21ba53
MD5 9375d8bd3b4f53b7e577bf573ae66c59
BLAKE2b-256 acbec66f832d002d7df6456495b6c342c0079739b271374a00a4e3af203c3f60

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page