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 –
Method 1 –
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
io.selendroid.testapp/io.selendroid.testapp.HomeScreenActivity
App package: io.selendroid.testapp
App Activity: io.selendroid.testapp.HomeScreenActivity
Method 2 –
Independent of OS – on the mobile device or simulator –
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 –
Method 1 –
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]"'
Method 2 –
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 above link] – 1069512615
- Now construct the link to get the bundleID as – https://itunes.apple.com/lookup?id=[appID_from_the_link]
https://itunes.apple.com/lookup?id=1069512615
- 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
“bundleId”:”com.apple.MobileAddressBook”
Method 3
From the .ipa file itself –
If you have downloaded the .ipa file from some source, then
- Rename the .ipa to .zip (let’s say myApp.zip)
- Extract the zip file > you will get myApp.app file
- Right click on the myApp.app file > Show Package Contents > open the info.plist file in xcode
- Open the search (Command + f) > search for “Bundle Identifier” to get the bundleId
In the 2nd image from below, you should see the bundleId – com.saucelabs.mydemoapp.rn
From the .app file itself –
If you have .app file, then
- Right click on the application (let’s say myApp.app file) > Show Package Contents
- Open the
info.plist
file in xcode - Open the search (Command + f) > search for “Bundle Identifier” to get the bundleId
Method 4
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]
com.example.apple-samplecode.UICatalog
2 Comments