DeviceAction - Landscape And Portrait
Description
You can toggle the orientation of the device reflection by using the key events for Landscape and Portrait.
info
This command is supported in Android only. Android version must be 4.1 or above when using non-instrumented applications.
Usage
Using command to toggle orientation on an Android device to landscape mode by sending the text 'Landscape' or to portrait by sending 'Portrait'
info
Replace <server> with the appropriate URL.
- Public Continuous Testing Cloud - https://cloud.seetest.io/wd/hub/.
- Dedicated Continuous Testing Cloud environment - Your own domain. For example: https://company.experitest.com/wd/hub/
- On-premises Continuous Testing Cloud environment - Your designated URL. For example: https://company.com/wd/hub
Example
Landscape and Portrait
DesiredCapabilities dc = new DesiredCapabilities();
driver = new AndroidDriver(new URL("<server>"), dc);
seetest = new SeeTestClient(driver);
dc.setCapability(MobileCapabilityType.UDID, "<deviceid>");
...
...
//This command sets the orientation to Portrait or Landscape.
seetest.deviceAction("Portrait");
seetest.deviceAction("Landscape");
Advanced configuration:
Some devices will require advanced configuration in order to toggle orientation properly. For those, you can use the following with SendTextCommand:
- For landscape orientation use:
{LANDSCAPE_0}, {LANDSCAPE_90}, {LANDSCAPE_180}, {LANDSCAPE_270}
to control the orientation and its direction. - For portrait orientation use:
{PORTRAIT_0}, {PORTRAIT_90}, {PORTRAIT_180}, {PORTRAIT_270}
.
For example:
{LANDSCAPE_90}
is the equivalent of{PORTRAIT_0}
.{PORTRAIT_180}
is equivalent of the being device upside down.