Testing will always be performed in a fixed context with respect to Appium server and that context will be set by desired capabilities. There are some mandatory desired capabilities and some are device OS-specific, such as Android or iOS. If you navigate to the HomePageSteps class file and the iLaunchQuikr() method, you will note the following mentioned lines:
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "5.1");
capabilities.setCapability("deviceName", "Nexus");
So, platformName, platformVersion, and deviceName are mandatory desired capabilities, which form the basis of mobile automation.
Here are some of the capabilities that are applicable for both iOS as well as Android devices:
Capability | Description & Usage |
automationName |
This is used to specify the automation engine to be used. Values: Appium (default) or Selendroid |
platformName |
This is used to specify which mobile OS platform to use for the session. capabilities.setCapability("platformName", "Android"); |
platformVersion |
This is used to specify which mobile OS version to be used for the session, and it should match the emulator or device under test. capabilities.setCapability("platformVersion", "5.1"); |
deviceName |
This is used to specify which mobile device or emulator is in use. For Android, any string can be passed. capabilities.setCapability("deviceName", "Nexus"); |
app |
This is used to specify the absolute local path to an .ipa or .apk file. capabilities.setCapability("app", "/Users/Development/HelloAppium/app.apk"); |
browserName |
This is used to specify the name of the mobile web browser to automate. Values: Safari, Chrome, Chromium, and Browser capabilities.setCapability("browserName", "Browser"); |
newCommandTimeout |
This is used to specify the time (in seconds) Appium will wait for a new command from the client before assuming that the client quit and ending the session. capabilities.setCapability("newCommandTimeout", 120); |
language |
This is used to specify the language for the simulator or emulator. (usage example, fr) |
locale |
This is used to specify the locale to set for the iOS Simulator For example, fr_CA |
udid |
This is used to specify the unique device identifier of the connected physical device For example, 1ae203187fc012g capabilities.setCapability("udid", 1ae203187fc012g); |
orientation |
This is used to specify the orientation for simulator or emulator. LANDSCAPE or PORTRAIT |
autoWebview |
This is used to move directly into Webview context; default value is false. Values: true and false capabilities.setCapability("autoWebview", true); |
noReset |
Don't reset the app state; the default value is false. This flag is used when you don't want to reset the app state. Values: true and false capabilities.setCapability("noReset", true); |
fullReset |
Reset app state; in iOS, delete the entire simulator folder. In Android, reset the app state by uninstalling the app and clearing all data; full reset requires an app capability. The default value is false. Values: true and false capabilities.setCapability("fullReset", true); |