.window.getRect() Suggest edits
Fetches 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.
Usage
.window.getRect([callback])
Example
module.exports = {
'get current window rect': function (browser) {
browser.window.getRect(function (result) {
console.log('Size of current window:', result.value.width, result.value.height);
console.log('Position of current window:', result.value.x, result.value.y);
});
},
'get current window rect using ES6 async/await': async function (browser) {
const {width, height, x, y} = await browser.window.getRect();
console.log('Size of current window:', width, height);
console.log('Position of current window:', x, y);
}
}
Parameters
Name | Type | description |
---|---|---|
callback Optional |
function | Callback function which is called with the result value. |
Returns
Type | description |
---|---|
* | Size and position of the current window. |