Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Device Setup Properties

Name

Description

Example (Java)
udid

unique device identifier

dc.setCapability(MobileCapabilityType.UDID, "ABCDE12345");
platformVersion
specific mobile device version number
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.0")
deviceManufacture
device manufacture
dc.setCapability("deviceManufacturer", "samsung");
deviceModel
device model
dc.setCapability("deviceModel", "iphone 6");
deviceCategory
device category
dc.setCapability("deviceCategory", "PHONE");
deviceWithAudio

For devices with audio injection \ extraction support (default: false)

dc.setCapability("deviceWithAudio", true);
deviceQuery

query device. For list of available properties.

dc.setCapability("deviceQuery", "@os='android' and @manufacture='samsung");

(see WaitForDevice)

orientation

start the test when the device in a certain orientation.

values: "landscape" / "portrait"

dc.setCapability(MobileCapabilityType.ORIENTATION, "landscape");
releaseDevice

Gives the capability to not release a device after performing driver.quit();

Values 'true'/false'

  1. default value is 'true' - release the device reservation at the end of the session
  2. 'false' value - cloud will 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 will be ignored and default value will be applied

deviceCleanup

performs a device cleanup after the session ends.

The option will onlybe 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 is ignored and a cleanup is performed unconditionally.

Values true/false

default value: true


Some of the important things to consider on the capabilities mentioned are,

  1.  deviceQuery - This capability will override any other capabilities set by the user, and it will determine the device for test
  2.  UDID - You can find the mobile device UDID 
  3.  Other Capabilities - The rest of the capabilities are just extensions of the deviceQuery capability (e.g Audio \ Manufacture) and we will construct a query based on the other capabilities which you have provided.
More Example

Usage Examples (Java)

Code Block
languagejava
dc.setCapability(MobileCapabilityType.UDID, "ABCDE12345");
Code Block
languagejava
titleSetting Platform Capability
dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.0")
Code Block
languagejava
titleSetting Device Manufacture Capability
dc.setCapability("deviceManufacturer", "samsung");
Code Block
languagejava
titleSetting Device Model Capability
dc.setCapability("deviceModel", "iphone 6");
Code Block
languagejava
titleSetting Device Category Capability
dc.setCapability("deviceCategory", "PHONE");
Code Block
languagejava
titleSetting Device with Audio Capability
dc.setCapability("deviceWithAudio", true);
Code Block
languagejava
titleSetting Device Query , Manufacturer and Platform Capability
dc.setCapability("deviceQuery", "@os='android' and @manufacture='samsung");
Code Block
languagejava
titleSetting Orientation Capability
dc.setCapability(MobileCapabilityType.ORIENTATION, "landscape");
Code Block
languagejava
titleSetting Release Device On Quit Capability
dc.setCapability("releaseDevice", false);


Code Examples:

Info
titleSet Experitest Url

Please make sure you replace <EXPERITEST_URL> with appropriate URL in the sample code's below.


Setup Device by UDID

The below examples demonstrate how to set a capability which will initialize the driver to connect to a device using the device UDID, as you can see: 


Code Block
languagejava
titleJava
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.UDID, "1162000958")
driver = new AndroidDriver<>(new URL("<EXPERITEST_URL>"), dc); 
Code Block
languagepy
titlePython
dc = {}
self.dc['udid'] = '1162000958'
self.driver = webdriver.Remote('<EXPERITEST_URL>', self.dc)
Code Block
languagec#
titleC Sharp
DesiredCapabilities dc = new DesiredCapabilities();
dc.SetCapability(MobileCapabilityType.Udid, "1162000958")
driver = new AndroidDriver<>(new URL("<EXPERITEST_URL>"), dc); 
Code Block
languageruby
titleRuby
 desired_caps = {
        caps: {
            udid: '1162000958',
        },
        appium_lib: {
            server_url: '<EXPERITEST_URL>',
        }
    }
    @driver = Appium::Driver.new(desired_caps, true).start_driver


Setup Device by Device Query

The below examples demonstrate how to set a capability which will initialize the driver to connect to a device using a dynamic query, based on the device characteristics (model and OS)


Code Block
languagejava
titleJava
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("deviceQuery", "@os='ios' and contains(@model, 'iphone')");
driver = new IOSDriver<>(new URL("<EXPERITEST_URL>"), dc); 
Code Block
languagepy
titlePython
dc = {}
self.dc['deviceQuery'] = "@os='ios' and contains(@model, 'iphone')"
self.driver = webdriver.Remote('<EXPERITEST_URL>', self.dc)
Code Block
languagec#
titleC Sharp
DesiredCapabilities dc = new DesiredCapabilities();
dc.SetCapability("deviceQuery", "@os='ios' and contains(@model, 'iphone')");
driver = new IOSDriver<>(new URL("<EXPERITEST_URL>"), dc); 
Code Block
languageruby
titleRuby
 desired_caps = {
        caps: {
            deviceQuery: "@os='ios' and contains(@model, 'iphone')",
        },
        appium_lib: {
            server_url: '<EXPERITEST_URL>',
        }
    }
    @driver = Appium::Driver.new(desired_caps, true).start_driver