How to use the appium-base-driver.errors.NoSuchWindowError 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-xcuitest-driver / lib / commands / context.js View on Github external
commands.setWindow = async function setWindow (name, skipReadyCheck) {
  try {
    await this.setContext(name, _.noop, skipReadyCheck);
  } catch (err) {
    // translate the error in terms of windows
    throw isErrorType(err, errors.NoSuchContextError)
      ? new errors.NoSuchWindowError()
      : err;
  }
};
github appium / appium-ios-driver / lib / commands / context.js View on Github external
commands.setWindow = async function setWindow (name, skipReadyCheck) {
  if (!this.isWebContext()) {
    throw new errors.NotImplementedError();
  }

  if (!_.includes(_.map(this.windowHandleCache, 'id'), name)) {
    throw new errors.NoSuchWindowError();
  }
  let pageIdKey = parseInt(name, 10);
  if (!this.isRealDevice()) {
    await this.remote.selectPage(pageIdKey, skipReadyCheck);
    this.curContext = this.curWindowHandle = name;
  } else {
    if (name === this.curWindowHandle) {
      logger.debug(`Remote debugger is already connected to window '${name}'`);
    } else if (!_.includes(_.map(this.windowHandleCache, 'id'), name)) {
      throw new errors.NoSuchWindowError();
    } else {
      await this.remote.disconnect();
      this.curContext = this.curWindowHandle = name;
      await this.remote.connect(name);
    }
  }