How to use the appium-base-driver.errors.UnknownCommandError function in appium-base-driver

To help you get started, we’ve selected a few appium-base-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-ios-driver / lib / commands / execute.js View on Github external
commands.executeMobile = async function executeMobile (mobileCommand, opts = {}) {
  // we only support mobile: scroll
  if (mobileCommand === 'scroll') {
    await this.mobileScroll(opts);
  } else if (mobileCommand === 'viewportScreenshot') {
    return await this.getViewportScreenshot();
  } else {
    throw new errors.UnknownCommandError('Unknown command, all the mobile commands except scroll have been removed.');
  }
};
github appium / appium-xcuitest-driver / lib / commands / execute.js View on Github external
enrollBiometric: 'mobileEnrollBiometric',
    sendBiometricMatch: 'mobileSendBiometricMatch',
    isBiometricEnrolled: 'mobileIsBiometricEnrolled',

    clearKeychains: 'mobileClearKeychains',

    getPermission: 'mobileGetPermission',

    siriCommand: 'mobileSiriCommand',

    deleteFile: 'mobileDeleteFile',
    deleteFolder: 'mobileDeleteFolder',
  };

  if (!_.has(commandMap, mobileCommand)) {
    throw new errors.UnknownCommandError(`Unknown mobile command '${mobileCommand}'. Only ${_.keys(commandMap).join(', ')} commands are supported.`);
  }
  return await this[commandMap[mobileCommand]](opts);
};
github appium / appium-ios-driver / lib / commands / element.js View on Github external
if (this.isWebContext()) {
    let atomsElement = this.getAtomsElement(el);
    if (_.isNull(atomsElement)) {
      throw new errors.UnknownError(`Error converting element ID for using in WD atoms: '${el}'`);
    } else {
      return await this.executeAtom('get_attribute_value', [atomsElement, attribute]);
    }
  } else {
    if (attribute === 'contentSize') {
      return await this.getElementContentSize(el);
    }
    if (_.includes(['label', 'name', 'value', 'values', 'hint'], attribute)) {
      let command = `au.getElement('${el}').${attribute}()`;
      return await this.uiAutoClient.sendCommand(command);
    } else {
      throw new errors.UnknownCommandError(`UIAElements don't have the attribute '${attribute}'`);
    }
  }
};
github appium / appium-uiautomator2-driver / lib / commands / general.js View on Github external
deviceInfo: 'mobileGetDeviceInfo',

    changePermissions: 'mobileChangePermissions',
    getPermissions: 'mobileGetPermissions',

    performEditorAction: 'mobilePerformEditorAction',

    startScreenStreaming: 'mobileStartScreenStreaming',
    stopScreenStreaming: 'mobileStopScreenStreaming',

    getNotifications: 'mobileGetNotifications',
  };

  if (!_.has(mobileCommandsMapping, mobileCommand)) {
    throw new errors.UnknownCommandError(`Unknown mobile command "${mobileCommand}". ` +
      `Only ${_.keys(mobileCommandsMapping)} commands are supported.`);
  }
  return await this[mobileCommandsMapping[mobileCommand]](opts);
};
github appium / appium-android-driver / lib / commands / execute.js View on Github external
changePermissions: 'mobileChangePermissions',
    getPermissions: 'mobileGetPermissions',

    performEditorAction: 'mobilePerformEditorAction',

    sensorSet: 'sensorSet',

    startScreenStreaming: 'mobileStartScreenStreaming',
    stopScreenStreaming: 'mobileStopScreenStreaming',

    getNotifications: 'mobileGetNotifications',
  };

  if (!_.has(mobileCommandsMapping, mobileCommand)) {
    throw new errors.UnknownCommandError(`Unknown mobile command "${mobileCommand}". ` +
      `Only ${_.keys(mobileCommandsMapping)} commands are supported.`);
  }
  return await this[mobileCommandsMapping[mobileCommand]](opts);
};