003 用uiautomator2和weditor获取元素

1.cmd切换到指定python版本目录下

只有一个python不用切换版本
D:\Program Files\JetBrains\Python

2.安装uiautomator2

在命令行输入 :
(1)git clone https://github.com/openatx/uiautomator2
(2)pip install -e uiautomator2(pip install uiautomator2)
查看是否安装成功:
D:\Program Files\JetBrains\Python 3.6.6\Scripts或者:
命令行内输入where uiautomator2

3.安装pillow

在命令行输入**(1)pip install pillow**

4.安装手机端uiautomator2

(1)在手机成功连接电脑,输入adb devices时成功显示设备号时,
在命令行输入
python -m uiautomator2 init
备用方法(指定某台手机:python -m uiautomator2 init --serial 设备名

(2)若后续获取不到元素,在https://github.com/appium/appium-uiautomator2-server/releases/tag/v0.3.0
下载appium-uiautomator2开头的两个apk,并安装在手机上即可

4.安装weditor

(1)安装 pip install -U weditor
参考链接:https://blog.csdn.net/WsXOM853BD45Fm92B0L/article/details/90278242?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

(2)在cmd命令行中输入python -m weditor
注意:此命令用来打开weditor(若失败则采用方法5(1)

5.打开weditor和使用

(1)在命令行内输入:where weditor 检查
打开方式:

  1. 在cmd命令行中输入python -m weditor
  2. 在指定目录(一般是D:\Program Files\JetBrains\Python\Scripts)下双击,打开wedidtor

(2)在浏览器内输入:

http://192.168.0.103:17310并打开

使用操作:

注意:出现小麦穗后,再点击刷新即可。
003 用uiautomator2和weditor获取元素_第1张图片
图片参考链接:https://blog.csdn.net/qq_41664526/article/details/81102832?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

你可能感兴趣的:(09,移动端测试)