How to use the appium-base-driver.PROTOCOLS.MJSONWP 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 / test / e2e / safari / page-load-timeout-specs.js View on Github external
it('should not go to the requested page', async function () {
      await driver.timeouts({protocol: PROTOCOLS.MJSONWP, type: 'page load', ms: 5000}, '1dcfe021-8fc8-49bd-8dac-e986d3091b97');
      await driver.setUrl(env.GUINEA_TEST_END_POINT + '?delay=30000');

      // the page should not have time to load
      (await driver.getPageSource()).should.include('Let\'s browse!');
    });
  });
github appium / appium-ios-driver / test / e2e / safari / page-load-timeout-specs.js View on Github external
it('should go to the requested page', async function () {
      await driver.timeouts({protocol: PROTOCOLS.MJSONWP, type: 'command', ms: 120000}, '1dcfe021-8fc8-49bd-8dac-e986d3091b97');
      await driver.timeouts({protocol: PROTOCOLS.MJSONWP, type: 'page load', ms: 0}, '1dcfe021-8fc8-49bd-8dac-e986d3091b97');
      await driver.setUrl(env.GUINEA_TEST_END_POINT + '?delay=5000');

      // the page should load after 70000
      (await driver.getPageSource()).should.include('I am some page content');
      (Date.now() - startMs).should.be.above(5000);
    });
  });
github appium / appium-chromedriver / lib / chromedriver.js View on Github external
syncProtocol (cdVersion = null) {
    const coercedVersion = semver.coerce(cdVersion);
    if (!coercedVersion || coercedVersion.major < MIN_CD_VERSION_WITH_W3C_SUPPORT) {
      log.debug(`Chromedriver v. ${cdVersion} does not fully support ${PROTOCOLS.W3C} protocol. ` +
        `Defaulting to ${PROTOCOLS.MJSONWP}`);
      return;
    }
    const chromeOptions = getCapValue(this.capabilities, 'chromeOptions', {});
    if (chromeOptions.w3c === false) {
      log.info(`Chromedriver v. ${cdVersion} supports ${PROTOCOLS.W3C} protocol, ` +
        `but ${PROTOCOLS.MJSONWP} one has been explicitly requested`);
      return;
    }
    this.desiredProtocol = PROTOCOLS.W3C;
    // given caps might not be properly prefixed
    // so we try to fix them in order to properly init
    // the new W3C session
    this.capabilities = toW3cCapNames(this.capabilities);
  }
github appium / appium-android-driver / lib / commands / execute.js View on Github external
extensions.execute = async function execute (script, args) {
  if (script.match(/^mobile:/)) {
    logger.info(`Executing native command '${script}'`);
    script = script.replace(/^mobile:/, '').trim();
    return await this.executeMobile(script, _.isArray(args) ? args[0] : args);
  }
  if (!this.isWebContext()) {
    throw new errors.NotImplementedError();
  }
  const endpoint = this.chromedriver.jwproxy.downstreamProtocol === PROTOCOLS.MJSONWP
    ? '/execute'
    : '/execute/sync';
  return await this.chromedriver.jwproxy.command(endpoint, 'POST', {
    script,
    args,
  });
};
github appium / appium-uiautomator2-driver / lib / commands / element.js View on Github external
commands.getElementRect = async function (elementId) {
  if (this.isWebContext()) {
    log.debug(`Detected downstream chromedriver protocol: ${this.chromedriver.jwproxy.downstreamProtocol}`);
    if (this.chromedriver.jwproxy.downstreamProtocol === PROTOCOLS.MJSONWP) {
      const {x, y} = await this.chromedriver.jwproxy.command(`/element/${elementId}/location`, 'GET');
      const {width, height} = await this.chromedriver.jwproxy.command(`/element/${elementId}/size`, 'GET');
      return {x, y, width, height};
    }
    return await this.chromedriver.jwproxy.command(`/element/${elementId}/rect`, 'GET');
  }
  return await this.uiautomator2.jwproxy.command(`/element/${elementId}/rect`, 'GET');
};
github appium / appium-chromedriver / lib / chromedriver.js View on Github external
this.useSystemExecutable = useSystemExecutable;
    this.chromedriver = executable;
    this.executableDir = executableDir;
    this.mappingPath = mappingPath;
    this.bundleId = bundleId;
    this.executableVerified = false;
    this.state = Chromedriver.STATE_STOPPED;
    this.jwproxy = new JWProxy({server: this.proxyHost, port: this.proxyPort});
    this.verbose = verbose;
    this.logPath = logPath;
    this.disableBuildCheck = !!disableBuildCheck;
    this.storageClient = isAutodownloadEnabled
      ? new ChromedriverStorageClient({ chromedriverDir: this.executableDir })
      : null;
    this.capabilities = {};
    this.desiredProtocol = PROTOCOLS.MJSONWP;
  }