python 与appium中的uiautomator2环境搭建

    技术2022-07-12  67

    环境准备:

    appium server 1.7版本 下载地址:https://github.com/appium/appium-desktop/releases/tag/v1.5.0

    下载appium-desktop-Setup-1.5.0-ia32.exe 并启动服务

    安装appium-uiautomator2-driver

    使用npm命令安装,npm如何安装自己百度。

    npm install appium-uiautomator2-driver

    mac本需要自主下载两个apk,(appium-uiautomator2-server-v0.1.8.apk、appium-uiautomator2-server-debug-androidTest.apk)

    需要放在本机 path usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/uiautomator/目录下

    下载地址:https://github.com/appium/appium-uiautomator2-server/releases

    appium-python-client 只要大于1.0版本以上就行

    https://zhuanlan.zhihu.com/p/56792235

    python uiautomator2 安装 1.安装:

    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple uiautomator2

    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple weditor

    2.使用:

    python -m uiautomator2 init:# init 所有的已经连接到电脑的设备

    python -m weditor #启动weditor,用于定位手机元素,只是辅助功能

    python程序:

    复制代码 import os

    init 所有的已经连接到电脑的设备

    a = os.popen(“python -m uiautomator2 init”) print(a.read())

    #启动 weditor b = os.popen(“python -m weditor”) print(b.read()) 复制代码

    3.下载Android驱动:https://www.androiddevtools.cn/

    在使用 npm 命令安装常用的 Node.js web框架模块 express时出现:

    技术分享

    解决方法是

    在命令行切换到安装nodejs文件下的nodejs\node_modules\npm 后执行npm install express 比如我的安装路径是: K:\Program Files\nodejs\node_modules\npm\node_modules

    技术分享

    Processed: 0.011, SQL: 9