Change screen orientation
Your test case may require you to change the device orientation of the device. You can change the screen orientation of an Android or iOS device to set your application in portrait or landscape mode during the execution of the test.
If you are using BrowserStack SDK, you can set the following capability within the browserstack.yml
file:
Capability | Description | Values |
---|---|---|
deviceOrientation |
Set the screen orientation of mobile device | portrait, landscape Default: portrait |
BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.
Use the following code snippet to change the orientation of your preferred device:
Capability | Description | Values |
---|---|---|
deviceOrientation |
Set the screen orientation of mobile device | portrait, landscape Default: portrait |
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("deviceOrientation", "landscape");
var capabilities = {
'bstack:options' : {
"deviceOrientation" : "landscape",
},
}
AppiumOptions capabilities = new AppiumOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("deviceOrientation", "landscape");
$caps = array(
'bstack:options' => array(
"deviceOrientation" => "landscape",
),
)
desired_cap = {
'bstack:options' : {
"deviceOrientation" : "landscape",
},
}
capabilities = {
'bstack:options' => {
"deviceOrientation" => "landscape",
},
}
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("deviceOrientation", "landscape");
var capabilities = {
'deviceOrientation': 'landscape',
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("deviceOrientation", "landscape");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("deviceOrientation", "landscape");
desired_cap = {
'deviceOrientation': 'landscape'
}
desired_caps = {
'deviceOrientation': 'landscape'
}
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!