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
capabilities = {
"appium:orientation" => "LANDSCAPE"
}
options.setCapability("appium:orientation", "LANDSCAPE");
$capabilities = [
"appium:orientation" => "LANDSCAPE"
];
capabilities = {
"appium:orientation": "LANDSCAPE"
}
const capabilities = {
"appium:orientation": "LANDSCAPE"
};
options.AddAdditionalAppiumOption("appium:orientation", "LANDSCAPE");
Set screen orientation during a test
@driver.rotation = :landscape
((AppiumDriver) driver).rotate(ScreenOrientation.LANDSCAPE);
// php-webdriver has no rotate() helper; use the Appium W3C "mobile:" command
$driver->executeScript('mobile: setOrientation', ['orientation' => 'LANDSCAPE']);
driver.orientation = "LANDSCAPE"
await driver.setOrientation('landscape');
driver.Orientation = ScreenOrientation.Landscape;