Expand description

A set of parameters used to start an Appium session.

What are capabilities?

The information in the set is used to describe what sort of “capabilities” you want your session to have, for example, a certain mobile operating system or a certain version of a device.

When you start your Appium session, your Appium client will include the set of capabilities you’ve defined as an object in the JSON-formatted body of the request.

Capabilities are represented as key-value pairs, with values allowed to be any valid JSON type, including other objects. Appium will then examine the capabilities and make sure that it can satisfy them before proceeding to start the session and return an ID representing the session to your client library.

See also https://appium.io/docs/en/2.1/guides/caps/.

Platform-specific capabilities

You can create capabilities to pass to Appium sercer by using either android::AndroidCapabilities or ios::IOSCapabilities.

For example, if you wish to use UiAutomator2 as a driver for Android tests, you can write:

use appium_client::capabilities::android::AndroidCapabilities;
use appium_client::capabilities::{AppCapable, AppiumCapability, UdidCapable, UiAutomator2AppCompatible};

let mut capabilities = AndroidCapabilities::new_uiautomator();
capabilities.udid("emulator-5554");  // This capability selects the device you wish to run test on
capabilities.app("/apps/sample.apk"); // This is a path to apk on your computer
capabilities.app_wait_activity("com.example.AppActivity"); // This is an activity of a home screen of the app.

// If you wish to specify appium capabilities manually (without predefined methods),
// then use methods like set_bool, set_str, set_number
capabilities.set_bool("appium:noReset", true);

Blank capabilities

To use blank capabilities (without any predefined methods for ease of configuration), use empty::EmptyCapabilities. empty::EmptyCapabilities lets you configure Appium for any driver that was not implemented out of the box.

Note that you will loose many built in features for Android and iOS, basically empty::EmptyCapabilities requires that you setup everything by yourself (including some Appium commands).

Modules

  • Android capabilities
  • Automation name constants
  • Empty capabilities (for creating a blank client)
  • iOS capabilities

Traits