How to use the node-simctl.getScreenshot function in node-simctl

To help you get started, we’ve selected a few node-simctl 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 / screenshots.js View on Github external
return data;
    }
    log.warn('Tried to get screenshot from active MJPEG stream, but there ' +
             'was no data yet. Falling back to regular screenshot methods.');
  }

  try {
    return await getScreenshotFromWDA();
  } catch (err) {
    log.warn(`Error getting screenshot: ${err.message}`);
  }

  // simulator attempt
  if (this.isSimulator()) {
    log.info(`Falling back to 'simctl io screenshot' API`);
    return await simctlGetScreenshot(this.opts.udid);
  }

  // Retry for real devices only. Fail fast on Simulator if simctl does not work as expected
  return await retryInterval(2, 1000, getScreenshotFromWDA);
};