.getContext() 建議編輯
取得 Appium 正在執行的目前上下文。用於使用 Appium 測試混合式行動應用程式。
更多資訊請參閱:https://appium.dev.org.tw/docs/en/commands/context/get-context/
用法
.appium.getContext([callback])
範例
module.exports = {
'get current context': function (app) {
app
.appium.getContext(function (result) {
console.log('the current context is:', result.value);
});
},
'get current context with ES6 async/await': async function (app) {
const context = await app.appium.getContext();
console.log('the current context is:', context);
}
};
參數
名稱 | 類型 | 描述 |
---|---|---|
callback 選用 |
function | 使用結果值呼叫的回呼函式。 |
回傳
類型 | 描述 |
---|---|
字串 | null | 代表目前上下文的字串,或代表「沒有上下文」的 |