# mobile-rpa ## 参考 [参考文档](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector) [参考文章](https://blog.csdn.net/Master724/article/details/107962349) https://github.com/openatx/uiautomator2 https://www.genymotion.com/product-desktop/download/ ## 初始化项目 ```shell export HTTP_PROXY=http://127.0.0.1:7899 export HTTPS_PROXY=http://127.0.0.1:7899 # window 修改编码 # chcp 65001 poetry install #sudo apt-get install python3-tk ``` 运行android定位器 ```shell poetry run python -m weditor ``` ## shell 指令 查看设备号 ```shell adb devices ``` 查找APPID ```shell adb shell pm list packages -f ``` ## 坐标文件xxx_point.json 格式 示例 [deepcion_point.json](testcase/deepcion_point.json) 说明 这个文件可以 使用 类似于 utils.utils.UiFactory.save_point() 保存 也可以手动编写 格式: ```json { "btn_buy": { "description": "买入/开多", "point": { "x": 988.0, "y": 1066.5 } } } ``` - 唯一标识:btn_buy - description 描述 - point坐标 point 可以 使用weditor获取到的坐标 ![img.png](assets/img.png) ## 打包 ```shell #C:\Users\fzxs\anaconda3\envs\rpa\Lib\site-packages\uiautomator2\assets pyinstaller --clean --name mobile-tools -i assets/logo/32x32.ico main.py --add-data "C:/Users/fzxs/anaconda3/envs/rpa/Lib/site-packages/uiautomator2/assets:uiautomator2/assets" ``` ```shell pyinstaller --clean --name mobile-tools -w -i assets/logo/32x32.ico main.py ``` python -m uiautomator2 init