.window.getSize() 建議編輯
取得目前視窗的大小(以像素為單位)。
用法
.window.getSize([callback])
範例
module.exports = {
'get current window size': function (browser) {
browser.window.getSize(function (result) {
console.log('Size of current window:', result.value.width, result.value.height);
});
},
'get current window size using ES6 async/await': async function (browser) {
const {width, height} = await browser.window.getSize();
console.log('Size of current window:', width, height);
}
}
參數
名稱 | 類型 | 描述 |
---|---|---|
callback 選用 |
function | 使用結果值呼叫的回呼函式。 |
回傳
類型 | 描述 |
---|---|
* | 目前視窗的大小。 |