Home Guide Desired Capabilities in Appium

Desired Capabilities in Appium

By Jash Unadkat, Technical Content Writer at BrowserStack -

In a previous article, we discussed how Desired Capabilities in Selenium helps QA teams test their web applications in desired test environments on a Selenium Grid.

On similar lines, Desired Capabilities in Appium helps QAs instruct the Appium server about the desired mobile platform to be used as the test environment. Let’s understand this in detail with relevant examples.

What Are Desired Capabilities in Appium?

Desired Capabilities in Appium refer to the combination of key-value pairs encoded in a JSON object. These key-value pairs are defined by the QAs to request the Appium server for the desired test automation session.

Let’s consider an example of Desired Capabilities in Appium represented as a JSON object.

{
“platformName”: “Android”,
“platformVersion”: “10.0”,
“deviceName”: “Samsung Galaxy Note10”,
“automationName”: “Appium”,
“app”: “path for the app under test”
}

Using the above mentioned Desired Capabilities, the user is instructing the drivers to start the test automation session for the app at the mentioned path on a Samsung Galaxy Note 10 with Android version 10.0 using Appium.

As Appium supports both Android and iOS, it has a unique set of Capabilities for both platforms. The tables below mention commonly used Capabilities for Android and iOS.

Common Capabilities in Android

Capabilities Description Values
appPackageRepresents the Java package of the desired Android App to be testedcom.example.android.myApp, com.android.settings
appActivityRepresents the name of the desired activity to be launched from the package. It needs to be preceded by a ‘..MainActivity, .Settings
appWaitPackageRepresents the java package of Android App to wait forcom.example.android.myApp, com.android.settings
browserNameRepresents the name of the mobile web browser to be automated. The value should be an empty string if automating an app‘Safari’ for iOS 

One can refer to this link to view the complete set of Desired Capabilities for Android.

Common Capabilities in iOS

Capabilities Description Values
udidUnique identifier of the connected physical devicee.g 1ae203187fc012g
autoAcceptAlertsAccept all iOS alerts automatically if they pop up. The default value is falsetrue or false
safariInitialUrlInitial URL to be loaded. The default URL redirects to a local home pagee.g. https://www.github.com

Refer to this link to view the complete set of iOS Capabilities.

Market trends continue to evolve rapidly. Consequently, teams need to ensure that their apps are ready to cater to users operating on the latest mobile devices. They need to test their mobile apps extensively across a range of devices operating on multiple platforms (Android and iOS).

Teams also need to release faster to maintain an edge over competitors. In such a competitive landscape, platforms like BrowserStack are essential for streamlining and accelerating test cycles.

BrowserStack’s real device cloud provides teams with real Android and iOS devices for running both manual and automated tests. One just needs to choose the desired device to test on and configure the Capabilities for automating tests accordingly.

Try Automated App Testing for Free

One can easily generate the required Appium Desired Capabilities for iOS and Android devices using the Capabilities Generator by Browserstack. Just select the OS and desired device to test on along with the preferred programming language.

Appium Desired Capabilities

As configuring the tests with the ideal Desired Capabilities forms the basis of most automated app tests, understanding the basics of Appium Desired Capabilities is of utmost importance. This article aims to assist with fostering that understanding, thus giving devs and QAs the tools they need to craft an ideal customer experience.

BrowserStack Logo Test Instantly on 2000+ Real Devices & Browsers Get Started Free