Fast2 Common
Fast2 Common 是一个强大的 Android 自动化测试和 UI 交互工具包,提供了一系列可复用的模块,用于简化 Android 应用的自动化测试开发。
功能特性
- ADB 控制器 (ADBController): 封装了常用的 ADB 命令,提供简洁的 Python API
- UI 分析器 (UIAnalyzer): 分析 UI 层级结构,提取元素信息
- UI 交互工具 (UIInteraction): 提供点击、滑动等 UI 交互功能
- AI Tab 管理器 (TabManager): 智能管理和切换底部导航栏
- 探索策略 (ExplorationStrategy): 自动化应用探索策略
- AI 客户端 (AIClient): 集成智谱 AI,提供智能分析能力
- 元素定位器 (ElementLocator): 通过文字查找元素坐标
- 图标定位器 (IconLocator): 基于视觉识别的图标定位
- 文字定位器 (TextLocator): 智能文字匹配和定位
- 动画检测器 (AnimationDetector): 检测 UI 动画状态
- 坐标转换器 (CoordinateConverter): 屏幕坐标转换工具
- UI 变化检测器 (UIChangeDetector): 检测 UI 界面变化
- 断言工具 (UIAssertions): UI 状态断言验证
安装
pip install fast2common
快速开始
from fast2common import ADBController, UIAnalyzer, UIInteraction
# 初始化 ADB 控制器
adb = ADBController(device_id="your_device_id")
# 获取当前 UI 层级
xml_content = adb.dump_ui_hierarchy()
# 分析 UI
analyzer = UIAnalyzer()
elements = analyzer.parse_xml(xml_content)
# 点击元素
interaction = UIInteraction(adb)
interaction.click_element_by_bounds(bounds)
模块说明
ADBController
ADB 命令控制器,封装了常用的 ADB 操作:
from fast2common import ADBController
adb = ADBController(device_id="emulator-5554")
screenshot = adb.take_screenshot()
xml_content = adb.dump_ui_hierarchy()
adb.tap(x, y)
ElementLocator
通过文字查找元素坐标:
from fast2common import ElementLocator
locator = ElementLocator(adb)
coordinates = locator.find_element_by_text("设置")
IconLocator
基于视觉识别的图标定位:
from fast2common import IconLocator
icon_locator = IconLocator(adb)
coordinates = icon_locator.find_icon_by_description("搜索图标")
TabManager
AI 驱动的底部导航管理:
from fast2common import TabManager
tab_manager = TabManager(adb)
tab_manager.switch_to_tab("首页")
依赖
- Python >= 3.8
- zhipuai >= 1.0.0
- Pillow >= 9.0.0
开发安装
git clone https://github.com/fast2/fast2common.git
cd fast2common
pip install -e ".[dev]"
许可证
MIT License
贡献
欢迎提交 Issue 和 Pull Request!
联系方式
Metadata
Release files for fast2common 0.4.0
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 |
|---|---|---|---|---|
| fast2common-0.4.0.tar.gz | 63.4 kB | Without provenance | Details for fast2common-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fast2common-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for fast2common-0.4.0-py3-none-any.whl |
Total release size: 133.8 kB
Release files / fast2common-0.4.0.tar.gz
| Download URL | fast2common-0.4.0.tar.gz |
|---|---|
| Size | 63.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7f2964d1234ddba03b6b8723aa4f9e00c1cbdbdd2870530d8eab5634b059951
|
|
BLAKE2b-256 checksum How to use checksums |
74875c9c31a5992956596cd45289a6faf8e0e404728bff534c83f3002e3aeb6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / fast2common-0.4.0-py3-none-any.whl
| Download URL | fast2common-0.4.0-py3-none-any.whl |
|---|---|
| Size | 70.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12ed200affe2c78742e85e0602ce9d8b3f0929eca3d6ef15fa44bacdf32a417d
|
|
BLAKE2b-256 checksum How to use checksums |
20ffff7c8cafe3ca9a82585e6c5667c628e097d087367d4d32bcc14c73d4eb74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Security for fast2common 0.4.0
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.