Features

Change screen orientation

Appium allows you to change the screen orientation of your iOS and Android devices.
You can choose to either change the orientation at the start of the test or during a test.

Set screen orientation at the start of your test

Copy code
desired_caps = {
    'orientation': 'LANDSCAPE'
}
Copy code
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("orientation", "LANDSCAPE");
Copy code
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("orientation", "LANDSCAPE");
Copy code
desired_cap = {
	'orientation': 'LANDSCAPE'
}
Copy code
var capabilities = {
	'orientation': 'LANDSCAPE',
}
Copy code
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("orientation", "LANDSCAPE");

Set screen orientation during a test

Copy code
@driver.rotation = :landscape
Copy code
((AppiumDriver) driver).rotate(ScreenOrientation.LANDSCAPE);
Copy code
// not yet supported
Copy code
driver.orientation = "LANDSCAPE"
Copy code
driver.setOrientation('LANDSCAPE');
Copy code
driver.Orientation = ScreenOrientation.Landscape;