Fast2 Common - Android automation testing and UI interaction toolkit
Project description
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!
联系方式
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
fast2common-0.4.0.tar.gz
(63.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast2common-0.4.0.tar.gz.
File metadata
- Download URL: fast2common-0.4.0.tar.gz
- Upload date:
- Size: 63.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7f2964d1234ddba03b6b8723aa4f9e00c1cbdbdd2870530d8eab5634b059951
|
|
| MD5 |
a87feafd5b75b8bf3fe4f210afc686d1
|
|
| BLAKE2b-256 |
74875c9c31a5992956596cd45289a6faf8e0e404728bff534c83f3002e3aeb6c
|
File details
Details for the file fast2common-0.4.0-py3-none-any.whl.
File metadata
- Download URL: fast2common-0.4.0-py3-none-any.whl
- Upload date:
- Size: 70.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12ed200affe2c78742e85e0602ce9d8b3f0929eca3d6ef15fa44bacdf32a417d
|
|
| MD5 |
1962d4c6c12affbf753f15926352f7fe
|
|
| BLAKE2b-256 |
20ffff7c8cafe3ca9a82585e6c5667c628e097d087367d4d32bcc14c73d4eb74
|