.window.getAllHandles() 建議編輯
檢索目前工作階段可用的所有視窗控制代碼清單。
用法
.window.getAllHandles([callback])
範例
module.exports = {
'get all window handles': function (browser) {
browser.window.getAllHandles(function (result) {
console.log('available window handles are:', result.value);
});
},
'get all window handles with ES6 async/await': async function (browser) {
const windowHandles = await browser.window.getAllHandles();
console.log('available window handles are:', windowHandles);
}
}
參數
名稱 | 類型 | 描述 |
---|---|---|
callback |
function | 使用結果值呼叫的回呼函式。 |
返回
類型 | 描述 |
---|---|
陣列[string] | 所有可用視窗控制代碼的陣列。 |