Appium iOS Capabilities

Desired Capabilities are keys and values encoded in a JSON object, sent by Appium clients to the server when a new automation session is requested. They tell the Appium drivers all kinds of important things about how you want your test to work.

These Capabilities are available only on the XCUITest Driver and the deprecated UIAutomation Driver.

calendarFormat: Calendar format to set for the iOS Simulator e.g. gregorian. It applies only to a simulator, for example, Gregorian.

Example:

caps.setCapability("calendarFormat"," Gregorian");

bundleId: Bundle ID of the app under test. Useful for starting an app on a real device or for using other caps which require the bundle ID during test startup. To run a test on a real device using the bundle ID, you may omit the "app" capability, but you must provide "udid".

Example

caps.setCapability("bundleId", "io.appium.TestApp");

udid: Unique device identifier of the connected physical device    e.g. 1de204144ff112r. 

launchTimeout: Amount of time in ms to wait for instruments before assuming it hung and failing the session    e.g. 20000.

Example: 

caps.setCapability("launchTimeout","20000");

locationServicesEnabled: Force location services to be either on or off. Default is to keep current sim setting. You can apply it only on a simulator; you can give the Boolean value true or false.

Example:

caps.setCapability("locationServicesEnabled", "false");

locationServicesAuthorized: Set location services to be authorized or not authorized for app via plist, so that location services alert doesn't pop up. Default is to keep current sim setting. Note that if you use this setting you MUST also use the bundleId capability to send in your app's bundle ID.    Accepted value: true or false.

Example:

caps.setCapability("locationServicesAuthorized","true");

autoAcceptAlerts: Accept all iOS alerts automatically if they pop up. This includes privacy access permission alerts (e.g., location, contacts, photos). Default is false. Does not work on XCUITest-based tests. Accept value true or false.

Example:

caps.setCapability("autoAcceptAlerts","true");

autoDismissAlerts: Dismiss all iOS alerts automatically if they pop up. This includes privacy access permission alerts (e.g., location, contacts, photos). Default is false. Does not work on XCUITest-based tests. Accept Value: true or false.

nativeInstrumentsLib: Use native intruments lib (ie disable instruments-without-delay). Accept value: true or false.

Example:

caps.setCapability("nativeInstrumentsLib","true");

nativeWebTap: Enable "real", non-javascript-based web taps in Safari. Default: false. Warning: depending on viewport size/ratio this might not accurately tap an element. Accept value: true or false.

Example:

caps.setCapability("nativeWebTap","false");

safariInitialUrl: (Sim-only) (>= 8.1) Initial safari url, default is a local welcome page. e.g. https://www.github.com

safariAllowPopups: Allow javascript to open new windows in Safari. Default keeps current sim setting. Accept value: true or false.

Example:

caps.setCapability("safariAllowPopups","false");

safariIgnoreFraudWarning: Prevent Safari from showing a fraudulent website warning. Default keeps current sim setting. Accept value: true or false.

Example:

caps.setCapability("safariIgnoreFraudWarning","false");

safariOpenLinksInBackground: Whether Safari should allow links to open in new windows. Default keeps current sim setting. Accept value: true or false.

Example: 

caps.setCapability("safariOpenLinksInBackground","true");


keepKeyChains: Whether to keep keychains (Library/Keychains) when appium session is started/finished. Accept value: true or false.

Example:

caps.setCapability("keepKeyChains","true");

localizableStringsDir: Where to look for localizable strings. Default en.lproj.

processArguments: Arguments to pass to the AUT using instruments.

Example: 

caps.setCapability("processArguments","myflag");

interKeyDelay: The delay, in ms, between keystrokes sent to an element when typing.    It takes value in milliseconds.

Example:

caps.setCapability("interKeyDelay","100");

showIOSLog: Whether to show any logs captured from a device in the appium logs. Default false. Accept value: true or false.

sendKeyStrategy: strategy to use to type test into a test field. Simulator default: oneByOne. Real device default: grouped    oneByOne, grouped or setValue.

screenshotWaitTimeout: Max timeout in sec to wait for a screenshot to be generated. default: 10.

waitForAppScript: The ios automation script used to determined if the app has been launched, by default the system wait for the page source not to be empty. The result must be a boolean    e.g. true;, target.elements().length > 0;, $.delay(5000); true;

webviewConnectRetries: Number of times to send connection message to remote debugger, to get webview. Default: 8.

appName: The display name of the application under test. Used to automate backgrounding the app in iOS 9+.

customSSLCert: Add an SSL certificate to IOS Simulator.

webkitResponseTimeout: Set the time, in ms, to wait for a response from WebKit in a Safari session. Defaults to 5000. It is for real device only.

Tue, 03/02/2021 - 18:36

Authored by

Tarun Goswami, works as a Technical Lead at the well-known IT services company. With Over 11+ years of experience in Quality Assurance, he writes engaging and informative blogs in his spare time.
Tags