Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
};