Change or get the window rect. This is defined as a dictionary of the screenX, screenY, outerWidth and outerHeight attributes of the window.

Its JSON representation is the following:

  • x - window's screenX attribute;
  • y - window's screenY attribute;
  • width - outerWidth attribute;
  • height - outerHeight attribute.

All attributes are in in CSS pixels. To change the window react, you can either specify width and height, x and y or all properties together.


.windowRect({width, height, x, y}, [callback]);


Name Type description
options object

An object specifying either width and height, x and y, or all together to set properties for the window rect.


Optional callback function to be called when the command finishes.


module.exports = {
  'demo test .windowRect()': function(browser) {

     // Change the screenX and screenY attributes of the window rect.
     browser.windowRect({x: 500, y: 500});

     // Change the width and height attributes of the window rect.
     browser.windowRect({width: 600, height: 300});

     // Retrieve the attributes
     browser.windowRect(function(result) {

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

W3C WebDriver spec