How to use the appium-ios-driver.iosCommands.general function in appium-ios-driver

To help you get started, we’ve selected a few appium-ios-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 / general.js View on Github external
// find the keyboard, and hit the last Button
    log.debug('Finding keyboard and clicking final button to close');
    if (await this.getNativeAttribute('visible', keyboard) === 'false') {
      log.debug('No visible keyboard found. Returning');
      return;
    }
    let buttons = await this.findNativeElementOrElements('class name', 'XCUIElementTypeButton', true, keyboard);
    if (_.isEmpty(buttons)) {
      log.warn(`No button elements found. Unable to hide.`);
      return;
    }
    await this.nativeClick(_.last(buttons));
  }
};

commands.getStrings = iosCommands.general.getStrings;

commands.removeApp = async function removeApp (bundleId) {
  return await this.mobileRemoveApp({bundleId});
};

commands.launchApp = iosCommands.general.launchApp;

commands.closeApp = iosCommands.general.closeApp;

commands.keys = async function keys (keys) {
  if (!this.isWebContext()) {
    throw new errors.UnknownError('Command should be proxied to WDA');
  }
  let el = util.unwrapElement(await this.active());
  if (_.isEmpty(el)) {
    throw new errors.NoSuchElementError();
github appium / appium-xcuitest-driver / lib / commands / certificate.js View on Github external
}
        }, {
          waitMs: TMPSERVER_STARTUP_TIMEOUT,
          intervalMs: 300,
        });
        log.debug(`The temporary web server is running at http://${host}:${tmpPort}`);
      } catch (e) {
        throw new Error(`The temporary web server cannot be started at http://${host}:${tmpPort}.`);
      }
      if (this.isRealDevice()) {
        try {
          await this.proxyCommand('/url', 'POST', {url: certUrl});
        } catch (err) {
          if (this.isWebContext()) {
            // The command above does not always work on real devices
            await iosCommands.general.setUrl.call(this, certUrl);
          } else {
            throw err;
          }
        }
      } else {
        await openUrl(this.opts.udid || this.sim.udid, certUrl);
      }

      let isCertAlreadyInstalled = false;
      if (util.compareVersions(this.opts.platformVersion, '>=', '12.2')) {
        if (await installPost122Certificate(this, cn)) {
          await clickElement(this, Settings.Profile);
          await trustCertificateInPreferences(this, cn);
        } else {
          isCertAlreadyInstalled = true;
        }
github appium / appium-xcuitest-driver / lib / commands / general.js View on Github external
commands.getDeviceTime = async function getDeviceTime (format = MOMENT_FORMAT_ISO8601) {
  log.info('Attempting to capture iOS device date and time');
  if (this.isRealDevice()) {
    const { timestamp, utcOffset } = await utilities.getDeviceTime(this.opts.udid);
    return moment.unix(timestamp).utcOffset(utcOffset).format(format);
  } else {
    return await iosCommands.general.getDeviceTime.call(this, format);
  }
};
github appium / appium-xcuitest-driver / lib / commands / general.js View on Github external
log.warn(`No button elements found. Unable to hide.`);
      return;
    }
    await this.nativeClick(_.last(buttons));
  }
};

commands.getStrings = iosCommands.general.getStrings;

commands.removeApp = async function removeApp (bundleId) {
  return await this.mobileRemoveApp({bundleId});
};

commands.launchApp = iosCommands.general.launchApp;

commands.closeApp = iosCommands.general.closeApp;

commands.keys = async function keys (keys) {
  if (!this.isWebContext()) {
    throw new errors.UnknownError('Command should be proxied to WDA');
  }
  let el = util.unwrapElement(await this.active());
  if (_.isEmpty(el)) {
    throw new errors.NoSuchElementError();
  }
  await this.setValue(keys, el);
};

commands.setUrl = async function setUrl (url) {
  if (!this.isWebContext() && this.isRealDevice()) {
    return await this.proxyCommand('/url', 'POST', {url});
  }