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

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

Set screen orientation during a test

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