App自动化测试之启动应用
1、环境
JAVA版本:1.8.0_181,安装参考 https://blog.csdn.net/weixin_44084189/article/details/98966787
Android-SDK版本:24.4.1
Appium版本:1.17.1-1
2、启动Appium服务,连接设备,打开开发者选项
3、在cmd输入adb devices,查看设备是否连接成功
PS C:\Users\jiale.liu> adb devices
List of devices attached
2KE0219B08021149 device
4、启动代码如下
# coding=utf-8
from appium import webdriver
desired_caps = \
{
\'platformName\': \'Android\', # 测试版本
\'deviceName\': \'xxxxxxxxxx\', # 设备名
\'platformVersion\': \'10\', # 系统版本
\'appPackage\': \'xxxxxxxxxx\', # APK的包名
\'appActivity\': \'xxxxxxxx.MainActivity\', # apk的launcherActivity
\'autoGrantPermissions\': True, # 设置自动授权权限’
\'unicodeKeyboard\': True, # 输入中文时要加,要不然输入不了中文
\'resetKeyboard\': True, # 输入中文时要加,要不然输入不了中文
\'noSign\': \'True\', # 不需要再次签名
\'noReset\': \'True\' # 不需要清理数据,避免重新安装的问题
}
driver = webdriver.Remote(\'http://127.0.0.1:4723/wd/hub\', desired_caps)
备注:cmd输入指令aapt dump badging D:\test\xxx.apk(APK的全名,如手机淘宝.apk),查看APK相关信息
5、运行代码,APP启动成功