uiautomator2--WEditor(元素定位工具)安装和定位界面元素

安装adb

安装python-uiautomator2
pip install --pre -U uiautomator2

手机设备安装atx-agent
首先设备连接到PC,并能够adb devices发现该设备

输入python -m uiautomator2 init

4..终端中输入 pip install weditor安装weditor

5.终端中输入python -m weditor启动weditor


image.png

4.在输入框中输入设备号,开启实时(定位时,需要关闭实时。才能定位元素准确),点击connect


image.png

停止UiAutomator守护服务

https://github.com/openatx/uiautomator2/wiki/Common-issues

因为有atx-agent的存在,Uiautomator会被一直守护着,如果退出了就会被重新启动起来。但是Uiautomator又是霸道的,一旦它在运行,手机上的辅助功能、电脑上的uiautomatorviewer 就都不能用了,除非关掉该框架本身的uiautomator。下面就说下两种关闭方法

方法1:

直接打开uiautomator app(init成功后,就会安装上的),点击关闭UIAutomator

方法2:

d.service("uiautomator").stop()

# d.service("uiautomator").start() # 启动
# d.service("uiautomator").running() # 是否在运行
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。