.window.setPosition() 建議編輯
設定目前視窗的位置 - 將視窗移動到選定的位置。
用法
.window.setPosition(x, y, [callback])
範例
module.exports = {
'set current window position': function (browser) {
// Move the window to the top left of the primary monitor
browser.window.setPosition(0, 0, function (result) {
console.log('window moved successfully');
});
},
'set current window position using ES6 async/await': async function (browser) {
// Move the window to the top left of the primary monitor
await browser.window.setPosition(0, 0);
}
}
參數
名稱 | 類型 | 描述 |
---|---|---|
x |
數字 | 視窗左上角的新 x 座標。 |
y |
數字 | 視窗左上角的新 y 座標。 |
callback 選填 |
函式 | 當命令完成時呼叫的選填回呼函式。 |