View Source Improve this doc

windowHandlePosition

Protocol bindings to receive or change the position of the browser window. If the windowHandle URL parameter is falsy, the currently active window will be considered. (Not part of the official Webdriver specification).

Usage

1
browser.windowHandlePosition([windowHandle][,position]);

Parameters

Param Type Details
windowHandle
optional
String the window to receive/change the position
position
optional
Object the X and Y coordinates to position the window at, relative to the upper left corner of the screen

Example

windowHandlePosition.js
1
2
3
4
5
6
7
8
9
10
11
12
13
it('should get or set window position', function () {
// change the position of a specified window
client.windowHandlePosition('{dc30381e-e2f3-9444-8bf3-12cc44e8372a}', {x: 100, y: 200});
// or set the current window position
browser.windowHandlePosition({x: 100, y: 200});
// get the position of a specified window
var position = browser.windowHandlePosition('{dc30381e-e2f3-9444-8bf3-12cc44e8372a}');
// or of the current window
position = browser.windowHandlePosition();
console.log(position); // outputs: {x: 100, y: 200}
});