• Home
  • Testing
  • SAP
  • Web
  • Must Learn!
  • Big Data
  • Live Projects
  • Blog

This tutorial will help you to understand APPIUM automation tool. It will cover desired capabilities and APPIUM with Maven uses.

In this tutorial, you will learn-

What is Desired Capabilities

'Desired Capabilities' help us to modify the behavior of server while Automation. In Appium, it is a type of hashmap or key-value pair, used to send a command to APPIUM server. In APPIUM, all the client commands are running in the context of a session.

For example, a client sent POST/session request containing JSON object to APPIUM server.

Hence, to send any desired request or to maintain any desired session with the server, a set of Key and value pair is used. This is known as 'Desired Capabilities.'

import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName","Android Emulator");
        capabilities.setCapability("platformVersion", "4.4");

Important Role of Desired Capability-

  • 'DesiredCapabilities' help the user to control the session request with the server. For example- if we want iOS session then we might set Capability as PlatformName = iOS. Or if we want Android session then we might set Capability as PlatformName = Android.
  • 'DesiredCapabilities' are used to set up the Webdriver instance eg: FirefoxDriver, ChromeDriver, InternetExplorerDriver etc.
  • DesiredCapability is very useful for Selenium Grid. Eg: It is used to access different test cases on a different browser and different operating system. Based on mentioned DesiredCapability Grid, hub will point to the corresponding node. Here, these nodes are defined using 'set' property method eg:-
    DesiredCapabilities obj = new DesiredCapabilities(); 
  • A desired capability is a library defined package. Prior to use 'DesiredCapabilities',it should be imported from below mentioned library

APPIUM supports both Android and iOS. Therefore there are a separate set of Appium server capabilities.

Below table depicts some commonly used Android capabilities and its value to use-

Capabilities Description Values/Uses
appPackage Call desired Java package in android that user want to run Value= com.example.myapp/

Obj.setCapability("appPackage", "com.whatsapp");

appActivity Application Activity that user wants to launch from the package. Value= MainActivity, .Settings

Obj.setCapability("appActivity", "com.whatsapp.Main");

appWaitPackage Package from which application needs to wait for Value=com.example.android.myapp
appWaitActivity Any Android activity that user need wait time Value= SplashActivity

capabilities.setCapability("appWaitActivity", "com.example.game.SplashActivity")

NOTE- Refer this link 'https://appium.io/docs/en/writing-running-appium/caps/#android-only' to view more Android Capabilities

Below table depicts some commonly used iOS capabilities and its value to use-

Capabilities Description Values
LaunchTimeout Total time (in ms) to wait for instrumentation. 2000
UDID To identify unique device number for connected physical device 166aestu4

NOTE- Refer this link 'http://appium.io/slate/en/master/?java#ios-only ' to view more iOS Capabilities

Extracting Packages & Activities information

Packages are related to bundled files or classes. It gives an organized structure to modular programming. In Java, different packages are stored in a single Jar file. The user can easily call the jar file for full execution. Similar concepts followed in Mobile application development world.

In Android operating system, all applications are installed in the form of JAVA packages. Hence, to extract packages path information, Android PackageManager class is used.

It retrieves package and activity information of pre and post installed application. It is installed in Android devices.

You can get an instance of PackageManager class By calling getPackageManager().

This method can access and manipulate the packages and related permission of the installed applications.

For example -

PackageManager pManager = getPackageManager();
List<ApplicationInfo> list = pManager.getInstalledApplications(PackageManager.GET_META_DATA)			


  • Desired Capability always runs on key-value pair to send command to APPIUM Server .
  • Use 'PackageManager' class to extract application information in Android.