Appium Desired Capabilities are keys and values pair, helps Appium driver to run Appium tests on specific device [android or iOS] and application.
Desired Capabilities can be written using any Appium client language binding which will be sent to Appium server as JOSN object.
There are general Desired Capabilities which are applicable to both Android and iOS, and also each platform has their own capabilities.
Watch the details here –
General capabilities –
Applicable for both Android and iOS
Capabilities | Values |
---|---|
automationName | UiAutomator2 for Android XCUITest for iOS |
platformName | Android or iOS or FirefoxOS |
platformVersion | 7.0 or 8.0 or 8.1 etc for Android 12.0 or 12.2 etc for iOS |
deviceName | iPhone 4S or iPhone X etc for iOS Galaxy S4 or emulator – 5554 or AVD name for Android |
app | /abs/path/to/my.apk for Android http://myapp.com/app.ipa for iOS |
browserName | ‘Safari’ for iOS ‘Chrome’, ‘Chromium’, or ‘Browser’ for Android |
newCommandTimeout | 10 or 20 in seconds |
udid | e.g. 1ae203187fc012g |
noReset | true or false |
fullReset | true or false |
Android specific capabilities –
To get appPackage and appActivity
- Use apk info app into simulator (Watch the above video to visualise steps)
OR
- From windows OS cmd –
adb devices
adb shell
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
iOS specific capabilities –
Capabilities | Values |
---|---|
udid | e.g. 1ae203187fc012g |
autoAcceptAlerts | true or false |
To get bundleID –
In terminal, enter the following command (Watch the above video to visualise steps)
osascript -e 'id of app "Full path of ios app.app"’
Download sample iOS app source code to practice above command –
Path where app generated – /Users/[userName]/Library/Developer/Xcode/DerivedData
/UICatalog-***/Build/Products/Debug-iphonesimulator/UICatalog.app
Reference – https://appium.io/docs/en/writing-running-appium/caps/