How to Find appPackage & appActivity for an Application?

appPackage & appActivity are very essential parameters in Appium Automation. Appium server will know which application you are trying to communicate programmatically in the connected device.

So, here we are discussing the steps or procedure to find appPackage & appActivity

Prerequisite:

  • adb should be set
  • The Mobile device should be connected to the machine
  • Mobile App should be launched & active

Steps to find appPackage & appActivity:

  • Once Prerequisites are done, open Command Prompt in System.
  • Run below adb commands
    • adb devices
    • adb shell
    • dumpsys window windows | grep -E ‘mCurrentFocus|mFocusedApp’
  • Once we run, there will be a result from which we can get apppackage & activity values.
  • The below Image illustrate the outputs of all three commands

ADB commands & their output:

  • adb devices – This command is to know how many devices are connected to the computer at the moment
adb devices
  • adb shell – This command is to communicate with the Device

adb shell
  • dumpsys window windows | grep -E ‘mCurrentFocus|mFocusedApp’
    • This command will display appPackage & appActivity of an Application that is currently active on a Mobile Device.

dumpsys command
  • appPackage – before ‘/’ in the output is appPackage, usually, it starts with com.
appPackage
  • appActivity – after ‘/’ in the output is appActivity
appActivity

An alternative command to get appPackage & appActivity, if above method does not give you appPacage & appActivity then trt below command. Just connect the device & run only the below command.

  • adb shell dumpsys window | find ‘mCurrentFocus’

So, these are the steps to find appPackage & appActivity. These parameters can be added in Desired Capability to automate the desired application.

You can also check this video for more clarification on How to get appPackage & appActivity using the above-mentioned adb commands.

If you have any suggestions or critical feedback, please do not forget to leave them here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

Create your website with WordPress.com
Get started
%d bloggers like this: