Desired Capabilities

Go back to tutorial

Desired Capabilities 

We can define desired capabilities are keys and values encoded in a JSON object, that are sent by Appium clients to the server when a new automation session is requested. Further, desired capabilities tell the Appium drivers as to how you want your test to work. Also, every Appium client construct capabilities specific to the client’s language, but in the end, they are sent over to Appium as JSON objects.

Moreover, Appium supports many capabilities. In general, capabilities also differ by driver, though there are a standard set that most drivers pay attention to.

We will now consider a series of tables outlining various types of desired Capabilities, that are available for general as well as specific drivers.

General Capabilities

We consider capabilities that span multiple drivers.

Capability Values
automationName Appium (default) or Selendroid or UiAutomator2 or Espresso for Android or XCUITest for iOS or YouiEngine for application built with You.i Engine
platformName iOS, Android, or FirefoxOS
platformVersion e.g., 7.1, 4.4
deviceName iPhone Simulator, iPad Simulator, iPhone Retina 4-inch, Android Emulator, Galaxy S4, etc…. On iOS, this should be one of the valid devices returned by instruments with instruments -s devices. On Android this capability is currently ignored, though it remains required.
app /abs/path/to/my.apk or http://myapp.com/app.ipa
browserName ‘Safari’ for iOS and ‘Chrome’, ‘Chromium’, or ‘Browser’ for Android
newCommandTimeout e.g. 60
language e.g. fr
locale e.g. fr_CA, CA
udid e.g. 1ae203187fc012g
orientation LANDSCAPE or PORTRAIT
autoWebview true, false
noReset true, false
fullReset true, false
eventTimings e.g., true
enablePerformanceLogging true, false
printPageSourceOnFindFailure e.g., true

Specific Capabilities

 

For Android 

We define capabilities that are available only on Android-based drivers.

Capability Values
appActivity MainActivity, .Settings
appPackage com.example.android.myApp, com.android.settings
appWaitActivity SplashActivity, SplashActivity,OtherActivity, *, *.SplashActivity
appWaitPackage com.example.android.myApp, com.android.settings
appWaitDuration 30000
deviceReadyTimeout 5
allowTestPackages true or false
androidCoverage com.my.Pkg/com.my.Pkg.instrumentation.MyInstrumentation
androidCoverageEndIntent com.example.pkg.END_EMMA
androidDeviceReadyTimeout e.g., 30
androidInstallTimeout e.g., 90000
androidInstallPath e.g. /sdcard/Downloads/
adbPort 5037
systemPort e.g., 8201
remoteAdbHost e.g.: 192.168.0.101
androidDeviceSocket e.g., chrome_devtools_remote
avd e.g., api19
avdLaunchTimeout 300000
avdReadyTimeout 300000
avdArgs e.g., -netfast
useKeystore true or false
keystorePath e.g., /path/to.keystore
keystorePassword e.g., foo
keyAlias e.g., androiddebugkey
keyPassword e.g., foo
chromedriverExecutable /abs/path/to/webdriver
chromedriverArgs e.g., [“–disable-gpu”, “–disable-web-security”]
chromedriverExecutableDir /abs/path/to/chromedriver/directory
chromedriverChromeMappingFile /abs/path/to/mapping.json
chromedriverUseSystemExecutable e.g., true
autoWebviewTimeout e.g. 4
chromedriverPort e.g. 8000
chromedriverPorts e.g. [8000, [9000, 9005]]
intentAction e.g.android.intent.action.MAIN, android.intent.action.VIEW
intentCategory e.g. android.intent.category.LAUNCHER, android.intent.category.APP_CONTACTS
intentFlags e.g. 0x10200000
optionalIntentArguments e.g. –esn <EXTRA_KEY>, –ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>, etc.
dontStopAppOnReset true or false
unicodeKeyboard true or false
resetKeyboard true or false
noSign true or false
ignoreUnimportantViews true or false
disableAndroidWatchers true or false
chromeOptions chromeOptions: {args: [‘–disable-popup-blocking’]}
recreateChromeDriverSessions true or false
nativeWebScreenshot true or false
androidScreenshotPath e.g. /sdcard/screenshots/
autoGrantPermissions true or false
networkSpeed [‘full’,’gsm’, ‘edge’, ‘hscsd’, ‘gprs’, ‘umts’, ‘hsdpa’, ‘lte’, ‘evdo’] Check -netspeed option more info about speed emulation for avds
gpsEnabled true or false
isHeadless e.g., true
adbExecTimeout e.g., 50000
localeScript e.g., “Cyrl” (Cyrillic)
skipDeviceInitialization true or false
chromedriverDisableBuildCheck true or false
skipUnlock true or false
unlockType [‘pin’, ‘password’, ‘pattern’, ‘fingerprint’]
unlockKey e.g., ‘1111’
autoLaunch true or false
skipLogcatCapture true or false
uninstallOtherPackages e.g. “io.appium.example”, [“io.appium.example1”, “io.appium.example2”], ‘*’
disableWindowAnimation true, false

 

For UIAutomator (1 & 2)

In this case, these capabilities are available on UIA 1 and 2

Capability Values
otherApps e.g., “/path/to/app.apk”, https://www.example.com/url/to/app.apk, [“/path/to/app-a.apk”, “/path/to/app-b.apk”]

 

For UIAutomator2 Only

Further, these Capabilities are available only on the UiAutomator2 Driver

Capability Values
uiautomator2ServerLaunchTimeout e.g., 20000
uiautomator2ServerInstallTimeout e.g., 20000
skipServerInstallation true or false

 

For Espresso Only

Also, these Capabilities are available only on the Espresso Driver

Capability Values
espressoServerLaunchTimeout e.g., 50000

 

For iOS Only

Next, these Capabilities are available only on the XCUITest Driver and the deprecated UIAutomation Driver.

Capability Values
calendarFormat e.g. gregorian
bundleId e.g. io.appium.TestApp
udid e.g. 1ae203187fc012g
launchTimeout e.g. 20000
locationServicesEnabled true or false
locationServicesAuthorized true or false
autoAcceptAlerts true or false
autoDismissAlerts true or false
nativeInstrumentsLib true or false
nativeWebTap true or false
safariInitialUrl e.g. https://www.github.com
safariAllowPopups true or false
safariIgnoreFraudWarning true or false
safariOpenLinksInBackground true or false
keepKeyChains true or false
localizableStringsDir en.lproj
processArguments e.g., -myflag
interKeyDelay e.g., 100
showIOSLog true or false
sendKeyStrategy oneByOne, grouped or setValue
screenshotWaitTimeout e.g., 5
waitForAppScript e.g. true;, target.elements().length > 0;, $.delay(5000); true;
webviewConnectRetries e.g., 12
appName e.g., UICatalog
customSSLCert e.g. —–BEGIN CERTIFICATE—–MIIFWjCCBEKg…
—–END CERTIFICATE—–
webkitResponseTimeout e.g., 10000
remoteDebugProxy e.g. 12000 or “/tmp/my.proxy.socket”
enableAsyncExecuteFromHttps true or false
skipLogCapture true or false
webkitDebugProxyPort 12021

 

Enrich your profile and become Job Ready. Practice and Prepare for Mobile Testing (Appium) Exam Now!

Get expert advice and hundreds of Free Test – Try Mobile Testing (Appium) Practice Questions Now!

Go back to tutorial

Running Tests
Using –default-capabilities flag

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?