您好,登錄后才能下訂單哦!
java啟動(dòng)方法
1、需要安裝JAR
2、啟動(dòng)如下:
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;
}
}
三、獲取報(bào)名與簽名命令:
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啟動(dòng)方式:
appium -a 127.0.0.1 -p 4723 –U 4ca1558c --no-reset
五:DesiredCapabilities的參數(shù)配置和含義
1、本地安裝apk包的文件路徑設(shè)置,不需要安裝就不用設(shè)置
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "apps");
File app = new File(appDir, "kingyee.apk");
2、在當(dāng)前session前不重置app狀態(tài)
capabilities.setCapability("noReset", true);
3、測(cè)試的web瀏覽器,如果是測(cè)app則忽略
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
4、平臺(tái)設(shè)置iOS, Android, or FirefoxOS
capabilities.setCapability("platformName", "Android");
5、設(shè)備序列號(hào)設(shè)置
capabilities.setCapability("deviceName", "Baytrail515B4E05");
6、系統(tǒng)版本號(hào)設(shè)置
capabilities.setCapability("platformVersion", "4.4.4");
7、避免重新簽名
capabilities.setCapability("noSign","true");
8、支持中文輸入
capabilities.setCapability("unicodeKeyboard","True");
9、重置輸入法到原有狀態(tài)
capabilities.setCapability("resetKeyboard","True");
10、設(shè)置apk的包名
capabilities.setCapability("appPackage", "com.kingyee.m");
11、設(shè)置啟動(dòng)Activity
capabilities.setCapability("appActivity", "com.kingyee.m.Start");
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。