Python-UiAutomator2实现Android自动化测试,,本帖转自搜狗测试公众
Python-UiAutomator2实现Android自动化测试,,本帖转自搜狗测试公众
本帖转自搜狗测试公众号
【一、前言】
【二、python中使用adb、aapt命令】
在python中使用adb命令,可以导入os模块
1、简单的adb命令
如:os.system(‘adb devices)
2、稍微复杂的adb命令
如:os.system(‘adb shell "dumpsys activity | grep "com.sogou.map.android.***.*""‘)
3、将adb读出的内容保存(os.system不支持读取,os.popen支持读取)
如:out = os.popen(‘adb shell "dumpsys activity | grep
"com.sogou.map.android.***.*""‘).read()
在python中使用aapt命令
aapt即Android Asset Packaging Tool,可以在Android SDK的platform-tools目录下找到该工具。aapt可以查看、创建、更新ZIP格式的文档,也可将资源文件编译成二进制文件。
1、 列出apk包的内容
aapt l[ist] [-v] [-a]file.{zip,jar,apk}
-v 以table形式列出来
-a 详细列出内容
2、 查看apk一些信息
aapt d[ump] [--values]WHAT file.{apk} [asset [asset ...]]
badging Print the label and icon for the app declaredin APK
permissions Print the permissions from the APK.
Resources Print the resource table from the APK.
Configurations Print the configurations in the APK.
Xmltree Print the compiled xmls in the given assets.
Xmlstrings Print the strings of the given compiled xmlassets.
例如:执行aapt d badging **.apk,可以看到其中包含了应用包名、版本号、permission等信息。
【三、Python-UiAutomator2使用】
【四、参考文献】
参考
https://github.com/openatx/uiautomator2
https://github.com/xiaocong/uiautomator#uiautomator
https://blog.csdn.net/jgw2008/article/details/78286469
https://testerhome.com/topics/11357
Python-UiAutomator2实现Android自动化测试
相关内容
- python 3三元运算符,,# 三元运算符(和其
- python告诉你ti8 dota2英雄bp,,文章链接:https
- Python列表中去重的多种方法,,怎么快速的对列表进行
- Python 之 ImportError: No module named ***,,如果想使用非当前
- Python——模块——时间模块,,1、time模块(1
- 2020年第三期《python接口自动化+测试开发》课程,4月
- opencv- python使用,,opencv_pyt
- python编程开发时间序列calendar模块示例详解,
- python中文件操作的其他方法,,前面介绍过Pytho
- python 文件操作,,文件基本操作:# -
评论关闭