How to use the appium-base-driver.errors.TimeoutError 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-remote-debugger / lib / remote-debugger.js View on Github external
res = await retryInterval(retries, retryWait, async () => {
        // the atom _will_ return, either because it finished or an error
        // including a timeout error
        if (await this.executeAtom('execute_script', [`return window.hasOwnProperty('${promiseName}Value');`, [null, null], subcommandTimeout], frames)) {
          // we only put the property on `window` when the callback is called,
          // so if it is there, everything is done
          return await this.executeAtom('execute_script', [`return window.${promiseName}Value;`, [null, null], subcommandTimeout], frames);
        }
        // throw a TimeoutError, or else it needs to be caught and re-thrown
        throw new errors.TimeoutError(`Timed out waiting for asynchronous script ` +
                                      `result after ${timer.getDuration().asMilliSeconds.toFixed(0)}ms'));`);
      });
    } finally {
github appium / appium-xcuitest-driver / lib / commands / proxy-helper.js View on Github external
if (!timeout) {
    return await proxy.command(endpoint, method, body);
  }

  log.debug(`Setting custom timeout to ${timeout} ms for '${cmdName}' command`);
  let isCommandExpired = false;
  const res = await B.resolve(proxy.command(endpoint, method, body))
                .timeout(timeout)
                .catch(B.Promise.TimeoutError, () => {
                  isCommandExpired = true;
                });
  if (isCommandExpired) {
    proxy.cancelActiveRequests();
    const errMsg = `Appium did not get any response from '${cmdName}' command in ${timeout} ms`;
    await this.startUnexpectedShutdown(new errors.TimeoutError(errMsg));
    log.errorAndThrow(errMsg);
  }
  return res;
};