Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

APPium automates the launch of mobile app notes

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Java startup method

1. You need to install JAR

2. Start as follows:

public class InitDriver {

public static AndroidDriver initDriver() throws Exception{

File app=new File("self install package.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, "Package Name");

caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "Signature");

caps.setCapability(AndroidMobileCapabilityType.UNICODE_KEYBOARD, true);

caps.setCapability(AndroidMobileCapabilityType.RESET_KEYBOARD, true);

caps.setCapability(AndroidMobileCapabilityType.NO_SIGN, true);

AndroidDriver driver=new AndroidDriver(

new URL("http://127.0.0.1:4723/wd/hub"), caps);

return driver;

}

}

III. Order to obtain registration and signature:

aapt d badging Desktop\xxxxx.apk |findstr "package launchable-activity"

For example:

aapt d badging Desktop\Toon-beijing-test.apk |findstr "package launchable-activity"

package: name='package name' versionCode='1709111541' versionName='1.8.0' platformBuildVersionName='7.1.1'

launchable-activity: name ='signature ' label =''icon =''

4 Appium Start Mode:

appium -a 127.0.0.1 -p 4723 -U 4ca1558c --no-reset

V: Parameter configuration and meaning of DesiredCapabilities

1. File path settings for local installation of apk package, no installation is required

File classpathRoot = new File(System.getProperty("user.dir"));

File appDir = new File(classpathRoot, "apps");

File app = new File(appDir, "kingyee.apk");

2. Do not reset app status before current session

capabilities.setCapability("noReset", true);

3. Test web browser, ignore if it is a test app

capabilities.setCapability(CapabilityType.BROWSER_NAME, "");

iOS, Android, or Firefox OS

capabilities.setCapability("platformName", "Android");

5. Equipment serial number setting

capabilities.setCapability("deviceName", "Baytrail515B4E05");

6. System version number setting

capabilities.setCapability("platformVersion", "4.4.4");

7. Avoid resigning

capabilities.setCapability("noSign","true");

8. Support Chinese input

capabilities.setCapability("unicodeKeyboard","True");

9. Reset the input method to its original state

capabilities.setCapability("resetKeyboard","True");

10. Set the package name of apk

capabilities.setCapability("appPackage", "com.kingyee.m");

11. Set Start Activity

capabilities.setCapability("appActivity", "com.kingyee.m.Start");

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report