Skip to main content

Device Setup

Use Device Setup to select the desired device(s).

Device Setup Properties 

NameDescriptionExample (Java)
udidUnique device identifierdc.setCapability(MobileCapabilityType.UDID, "ABCDE12345");
platformVersionMobile device version numberdc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.0")
deviceManufactureDevice manufacturerdc.setCapability("deviceManufacturer", "samsung");
deviceModelDevice modeldc.setCapability("deviceModel", "iphone 6");
deviceCategoryDevice categorydc.setCapability("deviceCategory", "PHONE");
deviceWithAudioDevice has audio injection \ extraction support (default: false)dc.setCapability("deviceWithAudio", true);
deviceQueryQuery device for list of available properties. This capability overrides any other capabilities set by the user and it determines the device to test.



(See WaitForDevice).
dc.setCapability("deviceQuery", "@os='android' and @manufacture='samsung");
orientationStart the test when the device in a certain orientation.



Values: "landscape" / "portrait"
dc.setCapability(MobileCapabilityType.ORIENTATION, "landscape");
releaseDeviceThis parameter is helpful if you’d like to keep the session active for subsequent tests without releasing the device after performing driver.quit().
* true (default) - Releases the device reservation at the end of the session.
* false - Cloud does not release the device reservation at the end of the session.

The ability to use the command depends on the permissions on the project for the connecting user.

If the user doesn't have the permission not to release the device on driver.quit(), the setting is ignored and default value is applied.

This flag is ignored and devices are not released in following cases:



* Device was previously reserved (future reservation)

* Device was opened in web studio 

* Device was opened in remote debug mode during the test



:::info
Supported for Shared Devices:::
dc.setCapability("releaseDevice", false);
reservationDurationAdjusts the reservation duration for automated tests. The value is specified in minutes. For example, the value 60 represents 1 hour.
::: info
Supported for Shared Devices :::
devicePoolAccepted Values: shared, dedicated, any
shared: Targets devices only from the shared pool
dedicated: Targets devices only from the dedicated pool
any: Prioritizes devices from the dedicated pool. If no devices or licenses are available, it will look in the shared pool
::: info
Supported for Shared Devices :::
deviceCleanupPerforms a device cleanup after the session ends.



The option will only be operational if the project settings allows it (in project settings - Settings --> Project --> Manage --> Device Policies, Enable release without cleanup is checked).



If Enable release without cleanup is unchecked, the settings deviceCleanup are ignored and a cleanup is performed unconditionally.



Values: true/false



Default value: true



Project cleanup is ignored with a shared device. After releasing the device it goes through a backup and restore process.
dc.setCapability("deviceCleanup", "false")
onlyAvailableUse only available devices.dc.setCapability("onlyAvailable", true);
configurationProfileInstalls an iOS configuration profile on the device.



This is supported only for iOS devices.
dc.setCapability("configurationProfile", "ABCD-123-EDF");
removeConfigurationProfileOn driver.quit(), removes the iOS config profile from the device that was installed using configurationProfile capability.



Values: true/false



Default value: false



This is supported only for iOS devices.
dc.setCapability("RemoveConfigurationProfile", true);
setPasscodeSets the passcode 123456 for an iOS device at session creation time.<br/><br/>dc.setCapability("setPasscode", true);<br/><br/>

Other than UDID, all of the capabilities are just extensions of the deviceQuery capability (for example Audio \ Manufacture). The query constructed is based on the other capabilities provided.

Returned Capabilities

The following list describes Continuous Testing specific capabilities that returns with the driver.

KeyTypeDescription
publicModelstringThe public model name of the device
cloudDeviceNamestringThe device name as it appears in the cloud
appBuildVersionstringThe application build version
appReleaseVersionstringThe application release version

Code Examples

info

Replace <server> with the appropriate URL.

Setup Device by UDID

These examples demonstrate how to set a capability which will initialize the driver to connect to a device using the device UDID.

Java

DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.UDID, "1162000958")
driver = new AndroidDriver<>(new URL("<server>"), dc);

Python

dc = {}
self.dc['udid'] = '1162000958'
self.driver = webdriver.Remote('<server>', self.dc)

C Sharp

DesiredCapabilities dc = new DesiredCapabilities();
dc.SetCapability(MobileCapabilityType.Udid, "1162000958")
driver = new AndroidDriver<>(new URL("<server>"), dc);

Ruby

 desired_caps = {
caps: {
udid: '1162000958',
},
appium_lib: {
server_url: '<server>',
}
}
@driver = Appium::Driver.new(desired_caps, true).start_driver

Setup Device by Device Query

These examples demonstrate how to set a capability which initializes the driver to connect to a device using a dynamic query, based on the device characteristics (model and OS).

Java

DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("deviceQuery", "@os='ios' and contains(@model, 'iphone')");
driver = new IOSDriver<>(new URL("<server>"), dc);

Python

dc = {}
self.dc['deviceQuery'] = "@os='ios' and contains(@model, 'iphone')"
self.driver = webdriver.Remote('<server>', self.dc)

C Sharp

DesiredCapabilities dc = new DesiredCapabilities();
dc.SetCapability("deviceQuery", "@os='ios' and contains(@model, 'iphone')");
driver = new IOSDriver<>(new URL("<server>"), dc);

Ruby

 desired_caps = {
caps: {
deviceQuery: "@os='ios' and contains(@model, 'iphone')",
},
appium_lib: {
server_url: '<server>',
}
}
@driver = Appium::Driver.new(desired_caps, true).start_driver