Skip to main content

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:

  1. Add the utility class to your project. See our Java example below:
SauceLabsCustomScreenshot Class
  1. Add the following code to your Espresso test scripts.

See our Java example below:

Sample Espresso test script
  1. Run your test on Sauce Labs Real Devices.

  2. 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:

    Mobile app settings navigation

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.