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 |
---|---|---|
|
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 ). |
|
|
If the script runs on a browser, the name of the mobile web browser. |
|
|
(iOS only) The case-sensitive bundle identifier of the application. Mandatory when you want to use a specific app. |
|
|
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. |
|
|
The device operating system. |
iOS , Android |
|
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. |
|
|
Perfecto-specific capability. By default, Perfecto works with real devices. Set to |
|
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:
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.
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");
}
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");
}