View Source Improve this doc

orientation

Protocol bindings for all mobile orientation operations. (Not part of the official Webdriver specification).

Usage

1
browser.orientation([deviceOrientation]);

Parameters

Param Type Details
deviceOrientation
optional
String The new browser orientation as defined in ScreenOrientation: `{LANDSCAPE PORTRAIT}`

Example

orientation.js
1
2
3
4
5
6
7
8
9
10
11
it('should set/get orientation using protocol command', function () {
// set the browser orientation. The orientation should be
// specified as defined in ScreenOrientation: {LANDSCAPE|PORTRAIT}
browser.orientation('landscape');

// get the current browser orientation. The server should
// return a valid orientation value as defined in
// screen orientation: {LANDSCAPE|PORTRAIT}
var orientation = browser.orientation();
console.log(orientation.value); // outputs: "landscape"
});

Returns

  • <String>: device orientation (LANDSCAPE/PORTRAIT)

Support

Support for android Support for ios