Change or get the size of the specified window. If the second argument is a function it will be used as a callback and the call will perform a get request to retrieve the existing window size.

Usage

Parameters

Name Type description
windowHandle string
width number
height number
callback
Optional
function

Optional callback function to be called when the command finishes.

Example

 this.demoTest = function (browser) {

   // Return the size of the specified window. If the :windowHandle URL parameter is "current", the size of the currently active window will be returned.
   browser.windowSize('current', function(result) {
     console.log(result.value);
   });

   // Change the size of the specified window.
   // If the :windowHandle URL parameter is "current", the currently active window will be resized.
   browser.windowSize('current', 300, 300, function(result) {
     console.log(result.value);
   });
}

See also