取得目前 Android 套件的名稱。

用法

                    .appium.getCurrentPackage([callback])
                

範例

module.exports = {
  'get current package name': function (app) {
    app
      .appium.getCurrentPackage(function (result) {
        console.log('current android package is:', result.value);
      });
  },

  'get current package name with ES6 async/await': async function (app) {
    const packageName = await app.appium.getCurrentPackage();
    console.log('current android package is:', packageName);
  }
};

參數

名稱 類型 說明
callback
選填
function

回呼函式,將使用結果值呼叫。

回傳

類型 說明
string

目前套件的名稱。

另請參閱