How to get the package name and appActivity of the application in appium

There are various ways to obtain the package name and appActivity of the application. The following is one of them:
use the aapt tool that comes with the Android SDK to obtain;
one. First download aapt

This aapt will not be automatically available after the Android SDK is installed. It must be installed through the "SDK Manager.exe" that comes with the package; as follows, double-click to open.
Insert picture description here
I selected the above three, and the progress bar below is in the process of installation. . .
After the download is complete, find aapt.exe in the directory C:\Program Files (x86)\adt-bundle-windows-x86\sdk\build-tools\21.1.2 (I chose the 21.1.2 version for download) ,

And add this directory to the path of the environment variable;
Insert picture description here
verify whether the installation is successful, under cmd: directly request aapt, the following interface appears, indicating that it was successful
Insert picture description here
. The following is to start getting the package name and launcherActivity

  1. Get package name

I put the apk to be tested in the following directory: D:\testApp
Insert picture description here
. Here you can see the package name of the apk:'com.puscene.client' (ps: you can also drag the apk directly to the command line, just It will be executed automatically)
2. Get launcherActivity

The above command to get the package name will also directly get the Activity, just look for it directly on the command line, as follows: The
Insert picture description here
launcherActivity value is:'com.puscene.client.activity.WelcomeActivity_'

three. After getting the information, we need to write a script

 其中定义的启动信息:

1.platformName:这里是android的apk

2.deviceName:手机设备名称,通过adb devices查看

3.platformVersion:android系统的版本号

4.appPackage:apk包名

5.appActivity:apk的launcherActivity

Note: 4 and 5 are the package name and activity obtained above.

Reference: https://www.cnblogs.com/heidouli/p/13099153.html

Guess you like

Origin blog.csdn.net/zhaoweiya/article/details/113119982