.window.getRect() 編集の提案
現在のウィンドウのサイズと位置(window rect)を取得します。
JSON表現は以下の通りです。
x
- ウィンドウのscreenX属性;y
- ウィンドウのscreenY属性;width
- outerWidth属性;height
- outerHeight属性.
すべての属性はCSSピクセル単位です。
使用方法
.window.getRect([callback])
例
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);
}
}
パラメータ
名前 | 型 | 説明 |
---|---|---|
callback オプション |
関数 | 結果値とともに呼び出されるコールバック関数です。 |
戻り値
型 | 説明 |
---|---|
* | 現在のウィンドウのサイズと位置。 |