您好,登錄后才能下訂單哦!
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");
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。