# dfh **Repository Path**: oscq/dfh ## Basic Information - **Project Name**: dfh - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-23 - **Last Updated**: 2026-03-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # dfh 这是一个Python项目。 ## 安装 1. 克隆仓库 2. 创建虚拟环境:`python -m venv .venv` 3. 激活虚拟环境:`.venv\Scripts\activate` (Windows) 4. 安装依赖:`pip install -r requirements.txt` ## 使用 ### AndroidEmulator 类 项目包含一个用于操作安卓模拟器的通用类 `AndroidEmulator`。 #### 示例用法 ```python from src.android_emulator import AndroidEmulator # 创建实例 emulator = AndroidEmulator() # 获取所有连接的设备 devices = emulator.get_all_emulators() print("Available devices:", devices) # 连接到模拟器 if emulator.connect_emulator('emulator-5554'): print("Connected to emulator") # 截图 emulator.screenshot('screen.png') # 滑动 emulator.swipe(100, 500, 100, 100, 1000) # 输入文本 emulator.input_text('Hello World') # 点击 emulator.tap(200, 300) # 断开连接 emulator.disconnect_emulator() ``` #### 方法说明 - `get_all_emulators()`: 获取所有连接的安卓设备/模拟器 - `connect_emulator(emulator_name)`: 连接到指定模拟器 - `screenshot(filename)`: 截取屏幕并保存 - `swipe(start_x, start_y, end_x, end_y, duration)`: 执行滑动操作 - `input_text(text)`: 输入文本 - `tap(x, y)`: 执行点击操作 - `disconnect_emulator()`: 断开连接 注意:需要安装 ADB 工具并将其添加到系统 PATH 中。 ## 许可证 [添加许可证信息]