Skip to main content

Device Setup

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

Device Setup Properties 

NameDescriptionExample (Java)
udidUnique device identifier.dc.setCapability(MobileCapabilityType.UDID, "ABCDE12345");
platformVersionMobile OS version.dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.0");
deviceManufactureDevice manufacturer.dc.setCapability("deviceManufacturer", "samsung");
deviceModelDevice model.dc.setCapability("deviceModel", "iphone 6");
deviceCategoryDevice category (for example, PHONE, TABLET).dc.setCapability("deviceCategory", "PHONE");
deviceWithAudioEnables audio injection/extraction support. Default: false.dc.setCapability("deviceWithAudio", true);
deviceQuerySelects a device using a property-based query. Overrides other device capabilities.dc.setCapability("deviceQuery", "@os='android' and @manufacture='samsung'");
orientationStarts the session in a specific orientation. Values: landscape, portrait.dc.setCapability(MobileCapabilityType.ORIENTATION, "landscape");
releaseDeviceReleases the device when the session ends. Default: true. Supported for Shared Devices.dc.setCapability("releaseDevice", false);
reservationDurationSets the device reservation duration in minutes. Supported for Shared Devices.dc.setCapability("reservationDuration", 60);
devicePoolSelects the device pool. Values: shared, dedicated, any. Supported for Shared Devices.dc.setCapability("devicePool", "shared");
deviceCleanupPerforms device cleanup after the session. Values: true, false. Default: true.dc.setCapability("deviceCleanup", false);
onlyAvailableUses only devices that are currently available.dc.setCapability("onlyAvailable", true);
configurationProfileInstalls an iOS configuration profile. iOS only.dc.setCapability("configurationProfile", "ABCD-123-EDF");
removeConfigurationProfileRemoves the installed configuration profile on driver.quit(). Default: false. iOS only.dc.setCapability("removeConfigurationProfile", true);
setPasscodeSets a device passcode at session start. iOS only.dc.setCapability("setPasscode", true);

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 Digital.ai Testing specific capabilities that returns with the driver. The capabilities have the digitalai: prefix.

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
reportUrlstringThe report URL
reportTestIdstringThe report test id
cloudViewLinkstringThe cloud view link
device.phoneNumber1stringThe phone number of the device
device.phoneNumber2stringThe phone number of the device

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