Python+Appium自动化测试-元素定位工具

三种定位工具:

  1. UiAutomatorViewer
    Android SDK 自带工具
    location:AndroidSDK安装目录/tools
    也可以去github下载standalone版本
    注意:截屏时,当前模拟器不能被其他程序占用,比如在截屏时Weditor也连接了终端,atx没有被卸载
  2. Appium Desktop Inspector
    Appium Server自带工具
    下载地址:https://github.com/appium/appium-inspector/releases
    注意:截屏时,当前模拟器不能被其他程序占用
  3. Weditor
    Uiautomator2自带工具
    安装命令:
    pip install Uiautomator2
    python -m uiautomator2 init
    pip install weditor
    确认安装命令:
    weditor -help
  • 安装遇到的问题:
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 645: illegal multibyte sequence
    方案一:降weditor版本
    pip install weditor==0.6.4
    方案二:启用python环境编码utf-8
    set PYTHONUTF8=1
  • 使用遇到的问题:WEditor出现python -m weditor
    方案:
    • 在模拟器或真机上卸载atx包
    • 运行 python -m weditor
posted @ 2023-12-27 10:46  兜妈爱兜兜  阅读(85)  评论(0)    收藏  举报