Real Devices Only
The Espresso Screenshot Capture functionality allows you to take screenshots of errors to support the visual verification of your debugging process.
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:
- Add the following code to your Espresso test scripts.
See our Java example below:
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 \
The endpoint will return a .zip file of all screenshots captured during the session.
- The screenshots cannot exceed more than 200 MB in size.
- You cannot change the filename of the screenshot. The code we provide allows you to supply the capture method with a string, but currently the string is ignored. We use a counter for the screenshot name. This is a known bug.