.window.setRect() 編集を提案
現在のウィンドウのサイズと位置(ウィンドウ矩形)を変更します。
そのJSON表現は以下の通りです。
x
- ウィンドウのscreenX属性;y
- ウィンドウのscreenY属性;width
- outerWidth属性;height
- outerHeight属性。
すべての属性はCSSピクセル単位です。
ウィンドウ矩形を変更するには、width
とheight
を一緒に指定するか、x
とy
を一緒に指定するか、またはすべてのプロパティを一緒に指定します。
使用方法
.window.setRect({width, height, x, y}, [callback])
例
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
});
}
}
パラメータ
名前 | 型 | 説明 |
---|---|---|
options |
オブジェクト | ウィンドウ矩形のプロパティを設定するための |
callback オプション |
関数 | コマンドが完了したときに呼び出されるオプションのコールバック関数。 |