Python笔记-uiautomator2环境搭建(安卓模拟器测试环境+windows开发环境)
发布日期:2021-06-30 10:46:52 浏览次数:2 分类:技术文章

本文共 710 字,大约阅读时间需要 2 分钟。

首先windows安装python3+,以及PyCharm

windows安装相关包:

pip install --pre uiautomator2

这里安装雷电模拟器,这里要记住,要用雷电模拟器自带的adb

where adb

启动雷电模拟器,开启开发者选项,以及USB调试,以及配置下模拟器IP地址。

 

重启下adb

adb kill-serveradb start-server

再查询是否检测到设备:

adb devices

查询到了,再安装ATX。

python -m uiautomator2 init

安装完后,会有这个图标:

点开他,按下:

发现启动不了。

这里直接进入shell,操作手机,进行打开。

adb shellchmod 775 /data/local/tmp/atx-agent/data/local/tmp/atx-agent server -d  (添加-d表示在后台动)

这样就打开了。不会提示Uiautomator not starting

下面安装weditor

pip install --pre -U weditor

然后启动

weditor

输入IP地址,点击Connect就可以连接了,下面的 代码是测试,可以启动APP

import uiautomator2 as u2d = u2.connect_wifi("192.168.1.100")d.app_start("com.sinovatech.unicom.ui")if __name__ == "__main__":    pass

下面介绍个adb命令,查询当前界面的包名

adb shell am monitor

 

转载地址:https://it1995.blog.csdn.net/article/details/114866817 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Python&Rabbitmq文档阅读笔记-生产者数据直接送入队列消费者消费
下一篇:Qt文档阅读笔记-QThreadPool官方解析及实例

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年05月03日 07时03分08秒