Rotate Device (FR)

Perfecto Command

mobile:device:rotate

Purpose

Rotates the device to either landscape or portrait. To rotate the device orientation, set method to Device. This will affect the screen orientation as well. To rotate the device view without manipulating the device screen, set method to be View. The Next parameter value in operation enables a 90° rotation.

The Rotate device function performs the same operation as the Rotate option in the Manual Testing view.

The operation and state parameters cannot be used together because they dictate a different behavior.

Parameters

Name Type Possible Values Description
operation String reset | next The state operation to perform on the device.
Reset - rotate the device to its default state
Next - rotate the device to its next state
state String portrait | landscape The device screen rotation state.
Portrait - long side of screen is vertical
Landscape - long side of screen is horizontal
method String device | view The rotation method.
Device - Rotate the device orientation (landscape/portrait)
View - Rotate the displayed image only

Return Value

None

Exceptions

None

Examples

Copy

Java sample

Map<String, Object> pars = new HashMap<>();
pars.put("state", "landscape");
String reStr = (String) driver.executeScript("mobile:device:rotate", pars);
Copy

C# sample

Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("operation", "next");
String reStr = (String) driver.ExecuteScript("mobile:device:rotate", pars);