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.

Note:

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. By default, this is the latest version supported. 1.12.0, 1.15.1, 1.17.0
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.

Note: 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 defaults to the latest OS version available. 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");
    }