.window.setRect() Suggest edits
Change the window rect - size and position of the current 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 CSS pixels.
To change the window rect, you can either specify width and height together, x and y together, or all properties together.
Usage
.window.setRect({width, height, x, y}, [callback])
Example
module.exports = {
'set current window rect': function (browser) {
// Change the screenX and screenY attributes of the window rect.
browser.window.setRect({x: 500, y: 500});
// Change the outerWidth and outerHeight attributes of the window rect.
browser.window.setRect({width: 600, height: 300});
},
'set current window rect using ES6 async/await': async function (browser) {
// Change all attributes of the window rect at once.
await browser.window.setRect({
width: 600,
height: 300,
x: 100,
y: 100
});
}
}
Parameters
| Name | Type | description |
|---|---|---|
options |
Object | An object specifying either |
callbackOptional |
function | Optional callback function to be called when the command finishes. |