.getContexts() 建議編輯
取得可用的上下文列表。當使用 Appium 測試混合行動應用程式時使用。
更多資訊請參考:https://appium.dev.org.tw/docs/en/commands/context/get-contexts/
用法
.appium.getContexts([callback])
範例
module.exports = {
'get available contexts': function (app) {
app
.appium.getContexts(function (result) {
console.log('the available contexts are:', result.value);
});
},
'get available contexts with ES6 async/await': async function (app) {
const contexts = await app.appium.getContexts();
console.log('the available contexts are:', contexts);
}
};
參數
名稱 | 類型 | 描述 |
---|---|---|
callback 可選 |
函式 | 使用結果值呼叫的回呼函式。 |
回傳值
類型 | 描述 |
---|---|
Array<string> | 代表可用上下文的字串陣列,例如 'WEBVIEW_' |