Appium Tutorials 2: Desired Capabilities & Android Capabilities

Appium Tutorials 2: What is Desired Capabilities?


Desired Capabilities 

Desired capabilities are basically JSON object (a set of keys and values) sent by the client to the server. It describes the capabilities for the automation session in which we are interested.  We will discuss the capabilities one by one; first, we will see the Appium server’s capabilities:  

We need to import “import org.openqa.Selenium.remote.DesiredCapabilities ” library for Java to work with the desired capabilities. 


Android capabilities  

Now, let’s discuss the Android capabilities, as shown below: 


 This capability is for the Java package of the Android app that you want to run, for example,, 

settings, and so on: 




By using this capability, you can specify the Android activity that you want to launch from your package, for example, Main Activity, .Settings, Calculator, and so on:  

caps. setCapability(“appActivity”, “”);   


Android activity for which the user wants to wait can be defined using this capability:  

caps.setCapability (“appWaitActivity”,””);  

Alternatively, you can also use this command. 


The Java package of the Android app you want to wait for can be defined using the following capability,  

for example, com.example. 

android.myApp,, and 

so on: 




You can set the timeout (in seconds) while waiting for the device to be ready, as follows; the default value is 5 seconds: 




You can enable the Chrome driver’s performance logging by the use of this capability. It will enable logging only for Chrome and web view; the default value is false:  

caps.setCapability (“enablePerformanceLogging”, “true”);   


To set the timeout in seconds for a device to become ready after booting, you can use the following capability:  

caps.setCapability( “androidDeviceReadyTimeout”,”20″);   


This capability is used to set DevTools socket name. It is only needed when an app is a Chromium-embedding browser. The socket is opened by the browser and the ChromeDriver connects to it as a DevTools client, for example, chrome_DevTools_remote:  

caps.setCapability(“androidDevice Socket”,”chrome_DevTools_remote”);   


Using this capability, you can specify the name of avd that you want to launch, for example, AVD_ NEXUS_5:  

caps.setCapability (“avd”,”AVD_NEXUS_5″);  


This capability will help you define how long you need to wait (in milliseconds) for an avd to launch and connect to the Android Debug Bridge (ADB) (the default value is 120000):  

caps.setCapability(“avdLaunch Timeout”,”230000″); 


You can specify the wait time (in milliseconds) for an avd to finish its boot animations using the following capability; the default wait timeout is 120000:  

caps.setCapability(“avdReady Timeout”,”240000″);   


To pass the additional emulator arguments when launching an avd, use the following capability, for example, netfast:  

caps.setCapability(“avdArgs”, “netfast”);  


You can give the absolute local path to the WebDriver executable (if the Chromium embedder provides its own WebDriver, it should be used instead of the original ChromeDriver bundled with Appium) using the following capability:  

caps.setCapability (“chromedriverExecutable”, “/abs/path/to/webdriver”);  


The following capability allows you to set the time (in milliseconds) for which you need to wait for the Web view context to become active; the default value is 2000:  

caps.setCapability (“autoWebviewTimeout”,”3000″);   


Intent action is basically used to start an activity, as shown in the following code. The default value is android.intent.action.MAIN. For example, android.intent.action.MAIN, android.intent.action.VIEW, and so on:  

caps.setCapability(“intentAction”, “android.intent.action.VIEW”);   


This provides the intent category that will be used to start the activity (the default is android. intent.category.LAUNCHER), for example, android.intent.category.LAUNCHER, android.intent.category.APP_CONTACTS:  

caps.setCapability(“intentCategory”,”android.intent.category. APP_CONTACTS”);  


Flags are used to start an activity (the default is 0x10200000), for example, 0x10200000:  

caps.setCapability(“intentFlags”, “0x10200000”);   


You can enable Unicode input by using the following code; the default value is false:  

caps.setCapability (“unicodeKeyboard”,”true”);  


You can reset the keyboard to its original state by using this capability. The default value is false:  

caps.setCapability (“resetKeyboard”,”true”);   



Leave a Reply