Capability Set Examples
This guide describes necessary capabilities that must be provided in order to implement some common automation testing scenarios. It only describes very minimum sets of capabilities required to be included. For refined setups more of them might need to be provided. Check the Capabilities reference for more details on each option available for the fine-tuning of UiAutomator2 driver sessions.
Application File (Real Device)¶
{
"platformName": "Android",
"appium:automationName": "uiautomator2",
"appium:udid": "<Phone_ID>",
"appium:app": "/path/to/local/package.apk"
}
appium:app can also be a remote app or an archive:
Sometimes it might also be necessary to explicitly provide the appium:appPackage
and appium:appActivity capabilities, in case the
driver is unable to autodetect them from the provided app package manifest. Refer to the
Activity Startup guide for more details.
Similarly, some scenarios may require appium:platformVersion
to be explicitly specified.
Application File (Emulator)¶
{
"platformName": "Android",
"appium:automationName": "uiautomator2",
"appium:avd": "<Emulator_Name>",
"appium:app": "/path/to/local/package.apk"
}
appium:app can also be a remote app or an archive:
Chrome (Real Device)¶
{
"platformName": "Android",
"appium:automationName": "uiautomator2",
"browserName": "Chrome",
"appium:udid": "<Phone_ID>"
}
Chrome (Emulator)¶
{
"platformName": "Android",
"appium:automationName": "uiautomator2",
"browserName": "Chrome",
"appium:avd": "<Emulator_Name>"
}
Pre-Installed App (Real Device)¶
{
"platformName": "Android",
"appium:automationName": "uiautomator2",
"appium:udid": "<Phone_ID>",
"appium:appPackage": "<App_Package_Id>",
"appium:appActivity": "<App_Activity_Id>",
"appium:noReset": true
}
The appium:noReset capability is set to true in order
to tell the driver that the app identified by appium:appPackage is already preinstalled and must
not be reset.
Pre-Installed App (Emulator)¶
{
"platformName": "Android",
"appium:automationName": "uiautomator2",
"appium:avd": "<Emulator_Name>",
"appium:appPackage": "<App_Package_Id>",
"appium:appActivity": "<App_Activity_Id>",
"appium:noReset": true
}
Custom Launch (Real Device)¶
This will start the session at the Android Home screen. Afterwards it is possible to use
application management methods like mobile: installApp
or mobile: activateApp to manage the app
lifecycle.