Use capabilities to select a device in Perfecto

Perfecto and Appium implementations allow you to specify device selection criteria using driver capabilities. These capabilities help Perfecto automatically select the best available device for your test based on desired characteristics.

Select a specific device

If you know the device ID of the device you want to run the script on, you can use the following capability:

Copy
Java
capabilities.setCapability("deviceName", "12345678");
Copy
C#
capabilities.SetCapability("deviceName", "12345678");

Alternatively, you can use the Manual Testing view in the Perfecto UI to generate capabilities automatically for the selected device.

Important: Avoid this approach for automated executions because the device might be busy, offline, or disabled.

Select a device based on supported features

When you create an Appium driver, you can choose a device by setting specific capabilities. Perfecto also lets you add Perfecto-specific capabilities to help you target devices with the features your test needs.

Example 1: Require location support, avoid fingerprint

For example, if your test needs a device that supports location but doesn’t support fingerprint, set these capabilities:

Copy
Java
capabilities.setCapability("perfecto:fingerPrintSupport", false);
capabilities.setCapability("perfecto:setLocationSupport", true);
Copy
C#
capabilities.SetCapability("perfecto:fingerPrintSupport", false);
capabilities.SetCapability("perfecto:setLocationSupport", true);

Example 2: Target Samsung Galaxy with Android 13 or 14 and Motion Injection

If your test needs a Samsung Galaxy device running Android 13 or 14 that supports motion injection, use the following capabilities:

Copy
Java
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "1[34]");
capabilities.setCapability("manufacturer", "Samsung");
capabilities.setCapability("model", "Galaxy.*");
capabilities.setCapability("perfecto:motionInjectionSupport", true);
Copy

C#

capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("platformVersion", "1[34]");
capabilities.SetCapability("manufacturer", "Samsung");
capabilities.SetCapability("model", "Galaxy.*");
capabilities.SetCapability("perfecto:motionInjectionSupport", true);

Use Perfecto auto-selection

The better approach for automation is to define the desired device characteristics and let Perfecto select the most appropriate available device.

When a specific device is not defined, Perfecto selects a leading device by default (in public cloud instances). Leading devices are:

  • Stable

  • Popular among real users

  • Updated with the highest available OS version

If a leading device is not available, Perfecto selects the device with the highest OS version that matches the criteria. For details, see Auto-selection of leading devices.

For enterprise clouds, Perfecto Support can configure leading devices upon request.

Define device selection capabilities

Capitalization matters: You must write most capabilities with lowercase keys, but a few require a capitalized first letter. Using the wrong case can result in the capability being ignored.

Uppercase capabilities

The following table lists capabilities that take a capitalized first letter.

Capability Description Example

Network

Simulated network profile

At&t

Resolution

Screen resolution

1080x2400

Location

Simulated GPS location

Canada

Lowercase capabilities

The following table lists capabilities that take a lowercase first letter.

Capability Description Example

platformName

OS type

Android

platformVersion

OS version

18.*

manufacturer

Device manufacturer

Samsung

model

Device model

iPad.*

deviceName

Exact device ID

12345678

openDeviceTimeout

Wait time (minutes) for device availability

5

Use regular expressions

Capability values support Java-style regular expressions, which enable flexible matching.

Pattern Matches

18.*

Any version starting with 18

18.[02]

18.0 or 18.2 (not 18.1)

iPad.*

Any iPad model (iPad Mini, and so on)

If a capability value includes a special regex character (for example, +, ., *), use a backslash (\) to escape it, as shown in the following example:

Copy
capabilities.setCapability("model", "Galaxy Note10\+");

More information on Java regular expressions can be found at various Java tutorial sites (for example, tutorialspoint.com).

Examples

Copy

iOS device with OS version 18 (any subversion)

capabilities.setCapability("platformName", "ios");
capabilities.setCapability("platformVersion", "18.*");
Copy

Samsung Galaxy with Android 13 or 14

capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "1[34]");
capabilities.setCapability("manufacturer", "Samsung");
capabilities.setCapability("model", "Galaxy.*");
Copy

iPhone with iOS 18.1 or 18.2

capabilities.setCapability("platformName", "ios");
capabilities.setCapability("platformVersion", "18.[12].*");
capabilities.setCapability("model", "iPhone.*");
Copy

Waiting for an Android 14 device to become available (timeout = 5

capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "14");
capabilities.setCapability("openDeviceTimeout", 5);

Troubleshooting tips

Use the following tips to identify and resolve common issues:

  • Verify capability capitalization.

  • If no matching device is found, loosen regex constraints.

  • Ensure values (such as Network) match existing profiles in your cloud.

  • For enterprise clouds, check with Perfecto Support for available device configurations.