志不强者智不达,言不信者行不果。这篇文章主要讲述APPium自动化启动手机应用笔记相关的知识,希望能为你提供帮助。
java启动方法
1、需要安装JAR
2、启动如下:
public class InitDriver {
public static androidDriver<
AndroidElement>
initDriver() throws Exception{
File app=new File("自己安装包.apk");
DesiredCapabilities caps=new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Android");
caps.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
caps.setCapability(MobileCapabilityType.UDID, "127.0.0.1:62001");
caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 600);
//caps.setCapability(MobileCapabilityType.FULL_RESET, true);
caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "包名");
caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "签名");
caps.setCapability(AndroidMobileCapabilityType.UNICODE_KEYBOARD, true);
caps.setCapability(AndroidMobileCapabilityType.RESET_KEYBOARD, true);
caps.setCapability(AndroidMobileCapabilityType.NO_SIGN, true);
AndroidDriver<
AndroidElement>
driver=new AndroidDriver<
AndroidElement>
(
new URL("http://127.0.0.1:4723/wd/hub"), caps);
return driver;
}
}
三、获取报名与签名命令:
aapt d badging Desktop\xxxxx.apk |findstr "package launchable-activity"
如:
aapt d badging Desktop\Toon-beijing-test.apk |findstr "package launchable-activity"
package: name=‘包名‘ versionCode=‘1709111541‘ versionName=‘1.8.0‘ platformBuildVersionName=‘7.1.1‘
launchable-activity: name=‘签名‘
label=‘‘ icon=‘‘
四appium启动方式:
appium -a 127.0.0.1 -p 4723
–U
4ca1558c
--no-reset
五:DesiredCapabilities的参数配置和含义
1、本地安装apk包的文件路径设置,不需要安装就不用设置
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "apps");
File app = new File(appDir, "kingyee.apk");
2、在当前session前不重置app状态
capabilities.setCapability("noReset", true);
3、测试的web浏览器,如果是测app则忽略
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
4、平台设置iOS,
Android, or FirefoxOS
capabilities.setCapability("platformName", "Android");
5、设备序列号设置
capabilities.setCapability("deviceName", "Baytrail515B4E05");
6、系统版本号设置
capabilities.setCapability("platformVersion", "4.4.4");
7、避免重新签名
capabilities.setCapability("noSign","true");
8、支持中文输入
capabilities.setCapability("unicodeKeyboard","True");
9、重置输入法到原有状态
capabilities.setCapability("resetKeyboard","True");
10、设置apk的包名
capabilities.setCapability("appPackage", "com.kingyee.m");
11、设置启动Activity
capabilities.setCapability("appActivity", "com.kingyee.m.Start");
【APPium自动化启动手机应用笔记】本文出自 “知止内明” 博客,请务必保留此出处http://357712148.blog.51cto.com/6440370/1968237
推荐阅读
- as3AIR 添加或删除ApplicationDirectory目录下文件
- appium多机并行测试
- react-native run-android Starting: IntentError type 3 Error: Activity class does not exist
- Android UsageStats(应用根据启动次数启动时间应用名称排序)
- android studio - 修改logcat颜色
- app的启动页面----四种APP启动页设计方案
- xp系统中文版高级选项选单变成英文了如何处理
- 怎样删除xp系统中的微信表情|xp系统下删除微信表情的办法
- xp系统如何更改wps自动备份时间|xp系统更改wps自动备份时间的办法