Mobile device has many applications, so we should let appium know on which application automated tests should run.
For this appium provides capabilities as appPackage & appActivity to identify the android application, and bundleID to identify the iOS application.
Most of the applications we do automation are from with in the organisation, so one best option is to get the appPackage, appActivity or bundleID from the dev team.
but if in case the dev team is not present in same organisation or you are practicing any public applications, then we do have other ways to fetch these capabilities.
Watch the demo here –
appPackage & appActivity for android apps –
For only windows OS –
Before proceeding to get the details, refer Appium setup for windows (Make sure you have Android SDK installed folder on your machine and environmental setup)
- If real device, then connect to computer with debug mode ON, if simulator, then just launch the simulator
- Launch the app and should be displayed on screen
- Open command prompt, Start -> Run -> cmd
Type following commands one by one
adb devices adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
From above, orange highlights is the app package and activity
App package: io.selendroid.testapp
App Activity: io.selendroid.testapp.HomeScreenActivity
Independent of OS –
In the mobile device or simulator, install apk info app, you can download from here
- Launch the apk info app
- Search for the application you want to get the appPackage and appActivity
- Long press & right click on the search result and tap on Detailed information
- There you will get the required appPackage & appActivity
bundleID for iOS apps –
iOS apps can be of file extension .app or .ipa
If you have .app file, then get the path of the .app file from local drive, then run the following command to fetch bundleID
osascript -e 'id of app "[.app file name with path]"'
If you are looking for bundleID of apps from apple app store, then follow as below
- We will take an example of Contacts app,
- Find the app store app link – https://apps.apple.com/us/app/contacts/id1069512615
- Get the id of app [from able link] – 1069512615
- Now construct the link to get the bundleID as – https://itunes.apple.com/lookup?id=[appID_from_the_link]
- Open the link https://itunes.apple.com/lookup?id=1069512615, this will download a text file
- Open the file and search for bundleID as below
If app installed in devices but not yet in app store [not yet released, may be in development]
For example, in my simulator, UIcatalog app installed, but not in app store
- Launch the simulator or connect real device with app installed to MAC computer
- On Mac, launch the Console [from spotlight search]
- On left side, select your device name, and search for the app name to get the bundleID [screenshot below]