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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年05月03日 07时03分08秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
CppWeekly 02,Fabonacci, exchange
2019-04-30
CppWeekly 04 if constexpr, if initialization
2019-04-30
CppWeekly 05 nested namespace and std::clamp
2019-04-30
CppWeekly 06 structured binding
2019-04-30
CppWeekly 08 constexpr
2021-07-03
CppWeekly 09 regex ( string_view )
2021-07-03
使gazebo_ros能够找到其他package的资源文件
2019-04-30
右键打开 visual studio developer command prompt
2019-04-30
利用AirSim在Unreal Engine上获取全景图像
2019-04-30
小米路由器mini 安装openWrt+更新源+挂载U盘+安装python
2019-04-30
C++ tips: throw和throw+对象的差别
2019-04-30
C++ tips: std::stringstream 对象的复用
2019-04-30
C++ tips: 类成员函数的参数默认值
2019-04-30
C++ tips: C++ Dark Corner 0 标准流格式化输出
2019-04-30