# Mobile RPA Example Specification 本目录定义 Android/iOS example 必须具备的结构和验收契约。**当前没有团队真实成功案例,因此本目录不是可复制实现,也不得宣称已跑通。** 先读: 1. [`../../development/RPA_ELEMENT_LOCATING.md`](../../development/RPA_ELEMENT_LOCATING.md) 2. [`../../development/RPA_MOBILE.md`](../../development/RPA_MOBILE.md) ## 为什么现在不放伪代码实现 移动端 selector、driver、Activity/context、权限弹窗和设备兼容性必须在真实授权设备上验证。没有成功案例时放一套看似完整的代码,会诱导开发者和 AI 猜 `resource-id`、默认取第一个设备或用坐标硬点,违背模板目标。 ## 未来成功 example 的固定结构 ```text mobile_rpa/ README.md android/ README.md assets/element-map.yaml scripts/service/device_session.py scripts/service/mobile_locator.py scripts/service/example_flow.py tests/test_locator_contract.py tests/integration/test_real_device.py.sample ios/ README.md assets/element-map.yaml scripts/service/device_session.py scripts/service/mobile_locator.py scripts/service/example_flow.py tests/test_locator_contract.py tests/integration/test_real_device.py.sample ``` 只有对应端出现真实成功案例后才创建代码文件。 ## Android example 完成标准 - 唯一设备 serial 和设备互斥 - doctor:ADB授权、包名、Activity、屏幕状态、driver - Appium Inspector/UIAutoDev 拾取步骤和原始 XML - element map:resource-id/content-desc/text/class/父容器 - Native/WebView context 选择 - 点击、输入、滑动和真实后置状态 - 权限弹窗、系统弹窗和人工验证 - screenshot + page source 失败留证 - 虚拟列表滚动后重新定位 - 至少一台授权真机完整跑通 ## iOS example 完成标准 - Mac、WebDriverAgent签名和设备 UDID 准备 - doctor:WDA、bundle id、系统版本、屏幕状态 - Appium Inspector 拾取和原始 page source - accessibility id/name、predicate/class chain 定位 - Native/WebView context 选择 - 系统 alert 和人工验证 - screenshot + page source 失败留证 - 至少一台授权真机完整跑通 ## element map 最小字段 ```yaml logical_name: login_button surface: android screen: 登录页 scope: package: com.example.app activity: .LoginActivity primary_locator: strategy: resource_id value: com.example.app:id/login expected_count: 1 ready_condition: visible: true enabled: true postcondition: description: 首页业务标记出现 verified_device: 待填写 verified_app_version: 待填写 ``` ## 状态升级规则 满足以下全部条件后,才可把本目录状态改为“已有成功案例”: 1. 提供用户确认的成功项目来源。 2. 在真实授权设备上跑通完整业务闭环。 3. 保存脱敏 element map 和失败证据样例。 4. 有默认离线单测和显式真实集成测试。 5. 经过设备重连、App重启和页面变化验证。 6. 用户人工验收通过。