Supported capabilities for virtual mobile devices

Perfecto supports virtual mobile devices using pure Appium. In addition to Appium capabilities, you can define the following capabilities for virtual mobile devices.

When working with Appium 2, which requires Java client 8.1.x, you must add the prefix perfecto: to any non-Appium capability (for example: “perfecto:useVirtualDevice”, true) or use the perfectoOptions notation. For details on upgrading to an Appium 2-complient client, see Upgrade to an Appium 2-compliant client and Appium 2-compliant client and Selenium 4 sample project.

The time zone of a virtual mobile device corresponds with the time zone of the data center in which the host machine resides.

Capability name Description Value/example

appiumVersion

The Appium version to use for your script. If no value is provided, Perfecto selects a default version. For a list of supported versions, see Supported platforms.

Important: When specifying an Appium 2 version, limit the notation to the major and minor version, without a patch number (for example 2.2, but not 2.2.1).

1.15.1, 1.17.0, 1.22.3, 2.2

browserName1, 2

If the script runs on a browser, the name of the mobile web browser.

Safari, Chrome

bundleId3

(iOS only) The case-sensitive bundle identifier of the application. Mandatory when you want to use a specific app.

io.appium.TestApp

deviceName

The kind of virtual device to use. Can be specific or generic. If you do not specify a device name, Perfecto launches any relevant virtual device. Regular expressions are also supported as a value.

In support of pure Appium, this parameter accepts the values iPhone Simulator and iPad Simulator. If your tests include these values, you can run them as they are. However, you must make sure that useVirtualDevice is omitted or set to true. Otherwise, an error occurs.

iPhone 11, iPad

platformName3

The device operating system.

iOS, Android

platformVersion

The version of the device operating system. If not provided, Perfecto uses the default version configured. Currently, this is iOS 16.4 for simulators and Android 14 for emulators. 

Regular expressions are also supported as a value.

12.0, 13.0, 13.3

useVirtualDevice3

Perfecto-specific capability. By default, Perfecto works with real devices. Set to true to work with simulators or emulators. This is the preferred method of working with virtual mobile devices.

True or false

1 You must include either bundleId or browserName.

2 If you work with iOS 16, you must use the bundleId and autoWebview capabilities instead of browserName, as follows:

Copy
capabilities.setCapability("bundleId", "com.apple.mobilesafari");
capabilities.setCapability("autoWebview", true);

3 Mandatory parameter

For example, to modify a script that runs against a real iOS device to run against a simulator, you only need to add the capability useVirtualDevice and set it to true (line 16 in script 2), provided the script includes the platformName capability and either the bundleId or browserName capability.

Copy

1 | Appium script running on Perfecto against a real device

public static void main(String[] args) throws MalformedURLException, IOException {
        System.out.println("Run started");

        String cloudName = System.getProperty("cloudName");
        String securityToken = System.getProperty("securityToken");

        String browserName = "mobileOS";
        DesiredCapabilities capabilities = new DesiredCapabilities(browserName, "", Platform.ANY);

        capabilities.setCapability("browserName", "Safari");
        capabilities.setCapability("deviceName", "iPhone X");
        capabilities.setCapability("platformName", "iOS");
        capabilities.setCapability("platformVersion", "13.3");

        capabilities.setCapability("securityToken", securityToken);

        IOSDriver driver = new IOSDriver(new URL("https://" + cloudName + "/nexperience/perfectomobile/wd/hub"), capabilities);

        driver.quit();

        System.out.println("Run ended");
}
Copy

Appium script running on Perfecto against a virtual device

public static void main(String[] args) throws MalformedURLException, IOException {
        System.out.println("Run started");

        String cloudName = System.getProperty("cloudName");
        String securityToken = System.getProperty("securityToken");

        String browserName = "mobileOS";
        DesiredCapabilities capabilities = new DesiredCapabilities(browserName, "", Platform.ANY);

        capabilities.setCapability("browserName", "Safari");
        capabilities.setCapability("deviceName", "iPhone X");
        capabilities.setCapability("platformName", "iOS");
        capabilities.setCapability("platformVersion", "13.3");

        capabilities.setCapability("securityToken", securityToken);
        capabilities.setCapability("useVirtualDevice", true);//Line added

        IOSDriver driver = new IOSDriver(new URL("https://" + cloudName + "/nexperience/perfectomobile/wd/hub"), capabilities);

        driver.quit();

        System.out.println("Run ended");
    }