Skip to main content

Device Setup

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

Device Setup Properties 

NameDescriptionExample (Java)
<br/><br/>udid<br/><br/>Unique device identifierdc.setCapability(MobileCapabilityType.UDID, "ABCDE12345");
<br/><br/>platformVersion<br/><br/>Mobile device version numberdc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.0")
<br/><br/>deviceManufacture<br/><br/>Device manufacturerdc.setCapability("deviceManufacturer", "samsung");
<br/><br/>deviceModel<br/><br/>Device modeldc.setCapability("deviceModel", "iphone 6");
<br/><br/>deviceCategory<br/><br/>Device categorydc.setCapability("deviceCategory", "PHONE");
<br/><br/>deviceWithAudio<br/><br/>Device has audio injection \ extraction support (default: false)dc.setCapability("deviceWithAudio", true);
<br/><br/>deviceQuery<br/><br/>Query 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");
<br/><br/>orientation<br/><br/>Start the test when the device in a certain orientation.



Values: "landscape" / "portrait"
dc.setCapability(MobileCapabilityType.ORIENTATION, "landscape");
releaseDeviceGive the capability to not release a 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



When running multiple tests on a shared device, it is recommended to use this capability as false, to keep the device.
dc.setCapability("releaseDevice", false);
<br/><br/>deviceCleanup<br/><br/>Performs 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