Espresso Screenshot Capture
Real Devices Only
The Espresso Screenshot Capture functionality allows you to take screenshots of errors to support the visual verification of your debugging process.
Capturing Screenshots
To take screenshots during an Espresso test run, follow the steps below. Make sure to handle exceptions in your test code to ensure a proper test run.
To capture screenshots:
- Add the utility class to your project. See our Java example below:
loading...
- Add the following code to your Espresso test scripts.
SauceLabsCustomScreenshot.capture("my-screenshot");
See our Java example below:
loading...
-
Run your test on Sauce Labs Real Devices.
-
After the test has run successfully, on the Test Cases page, click the Download Screenshots tab to download a .zip file with all the screenshots for each test case as shown below:
You can also use the API to fetch captured screenshots. To fetch the screenshots use the following API request:
curl --compressed \
-O https://{SAUCE_USERNAME}:{SAUCE_ACCESS_KEY}@{DATA_CENTER}.saucelabs.com/v1/rdc/jobs/{JOB_ID}/screenshots.zip
The endpoint will return a .zip file of all screenshots captured during the session.
Limitations
The screenshots cannot exceed more than 200 MB in size.