Additional Appium Capabilities Using DigitalAI:Options (Appium 2)
With the release of Appium 2, there have been improvements and additions to test capabilities.
Protocol Changes
Appium's API is based on the W3C WebDriver Protocol, and it has supported this protocol for years. Before the W3C WebDriver Protocol was designed as a web standard, several other protocols were used for both Selenium and Appium. These protocols were JSONWP (JSON Wire Protocol) and MJSONWP (Mobile JSON Wire Protocol). The W3C Protocol differs from the (M)JSONWP protocols in a few minor ways.
Until Appium 2.0, Appium supported both protocols, so that older Selenium and Appium clients could still communicate with newer Appium servers. Moving forward, support for older protocols will be removed.
You have these kinds of capabilities:
- Standard W3C capabilities
- Appium vendor capabilities
- Digital.ai vendor capabilities
For more information on migrating from Appium 1.x to 2x see Migrating from Appium 1.x to Appium 2.x.
Standard W3c Capabilites
The Standard W3C capabilities in Appium refer to the set of common capabilities that are recognized and supported by most WebDriver implementations, including Appium. These capabilities provide a consistent way to configure and control the WebDriver sessions for different automation frameworks and tools. For a list of standard capabilities, see WebDriver (w3c.github.io).
Appium Capabilities
One sinificant difference between the old and new protocols is the format of capabilities. Previously called "desired capabilities", and now called simply "capabilities", there is now a requirement for a "vendor prefix" on any non-standard capabilities. The list of standard capabilities is given in the WebDriver Protocol spec, and includes a few commonly used capabilities such as browserName
and platformName
.
These standard capabilities continue to be used as-is. All other capabilities must include a vendor prefix in their name. A vendor prefix is a string followed by a colon, such as appium:
. Most of Appium's capabilities go beyond the standard W3C capabilities and must therefore include vendor prefixes. We recommend you use appium:
unless directed otherwise instructed.
For example:
appium:app
appium:noReset
appium:deviceName
Digital.Ai Vendor Capabilities
All Digital.ai capabilities which supported by Appium OSS are provided by one object which is called digital.ai:options. The digital.ai capabilities are documented in Appium OSS Supported Capabilities and Device Setup.
For example, to use Appium 2 you need to set the appiumVersion capability as an option in the object.
Java Capabilities Sample
DesiredCapabilities dc = new DesiredCapabilities();
Map<String, Object> options = new HashMap<>();
options.put("appiumVersion", "2.0.0");
dc.setCapability("digital.ai:options",options);
Code Examples
Java Expand source
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("platformName","iOS");
Map<String, Object> digitalaiOptions = new HashMap<>();
digitalaiOptions.put("appiumVersion", "2.0.0");
digitalaiOptions.put("deviceQuery", "@os='ios' and @category='PHONE'");
dc.setCapability("digitalai:options", digitalaiOptions);
Map<String, Object> appiumOptions = new HashMap<>();
appiumOptions.put(MobileCapabilityType.APP, "cloud:com.experitest.ExperiBank");
appiumOptions.put(IOSMobileCapabilityType.BUNDLE_ID, "com.experitest.ExperiBank");
dc.setCapability("appium:options", appiumOptions);
Python Expand source
desired_caps = {
'platformName': 'iOS',
}
digitalai_options = {
'appiumVersion': '2.0.0',
'deviceQuery': "@os='ios' and @category='PHONE'",
}
desired_caps['digitalai:options'] = digitalai_options
appium_options = { 'app': 'cloud:com.experitest.ExperiBank',
'bundleId': 'com.experitest.ExperiBank',
}
desired_caps['appium:options'] = appium_options
Node.js Expand source
capabilities: [{
"platformName" : "android",
'appium:options': {
"appPackage":"com.experitest.ExperiBank"},
'digitalai:options' : {
"appiumVersion" : "2.0.0",
'deviceQuery': "@os='ios' and @category='PHONE'",
},
}