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
  
desired_caps = {
    'orientation': 'LANDSCAPE'
}
    Copy
  
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("orientation", "LANDSCAPE");
    Copy
  
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("orientation", "LANDSCAPE");
    Copy
  
desired_cap = {
	'orientation': 'LANDSCAPE'
}
    Copy
  
var capabilities = {
	'orientation': 'LANDSCAPE',
}
    Copy
  
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("orientation", "LANDSCAPE");
Set screen orientation during a test
    Copy
  
@driver.rotation = :landscape
    Copy
  
((AppiumDriver) driver).rotate(ScreenOrientation.LANDSCAPE);
    Copy
  
// not yet supported
    Copy
  
driver.orientation = "LANDSCAPE"
    Copy
  
driver.setOrientation('LANDSCAPE');
    Copy
  
driver.Orientation = ScreenOrientation.Landscape;