How to Find appActivity and appPackage for Android App?

appActivity & appPackage are required to launch a Mobile App on Android device.

In Selenium, we use URL to launch a webpage. However in Appium, it is required to use Activity and Package details of an Android App to launch it on a Device.

Let’s have look at the steps to find out the Activity & Package Name for Android App:

NOTE: Assuming that Android Device is connected to your computer via USB cable and USB Debugging option of Android Device is also enabled.

1. Launch the App that you want to test on Android Device

2. Open command prompt and execute following command to make sure that Android Device is connected:

adb devices

adbdevices

3. Execute following 2 commands one by one to get App Activity and Package Name:

adb shell
dumpsys window windows | grep -E 'mCurrentFocus'

GetActivityAndPackageCommand

Once you get the appActivity & appPackage, then you need to set them in Desired Capabitites like below:

DesiredCapabilities capabilities = DesiredCapabilities.android();
capabilities.setCapability("appPackage", "com.sec.android.app.popupcalculator");
capabilities.setCapability("appActivity", "com.sec.android.app.popupcalculator.Calculator");

If you find the information provided above is useful, please don’t forget to like us on Facebook, you can also leave the comment.

Leave a Reply

Your email address will not be published. Required fields are marked *