Retrieves the current window size.

For clients which are compatible with the W3C Webdriver API, getWindowSize is an alias of getWindowRect.

The getWindowRect command returns both dimensions and position of the window, using the windowRect protocol command.

Usage

.getWindowSize([callback])

Parameters

Name Type description
callback function

Callback function to be called when the command finishes.

Example

module.exports = {
  'demo test .getWindowSize()': function(browser) {
     // Retrieve the attributes
     browser.getWindowSize(function(value) {
       console.log(value);
     });
  },

  'getWindowSize ES6 demo test': async function(browser) {
     const value = await browser.getWindowSize();
     console.log('value', value);
  }
}

See also