Skip to content

MASTG-TECH-0178: Taking Screenshots

Screenshots show what an app displays on a screen at a given moment. They're useful as evidence and to determine which data a screen displays, for example, during manual validation. However, they only capture pixels and don't reveal any property of the UI elements, such as whether a view is marked as accessibility data sensitive. To inspect those properties, see Inspecting the UI Hierarchy.

Windows that use FLAG_SECURE appear black in screenshots taken with these methods.

Using adb

Use the screencap command to capture the screen and write the PNG image directly to your computer:

adb exec-out screencap -p > screenshot.png

Using Android CLI

Use the screen capture command:

android screen capture --output=screenshot.png

Add --annotate to draw labeled bounding boxes around the UI elements detected on the screen, which helps you refer to specific elements when you document the screen.

Using Maestro

Use the takeScreenshot command in a flow to capture the screen at a specific point, for example, after the flow has navigated to a screen that handles sensitive data:

appId: org.owasp.mastestapp
---
- tapOn: "Start"
- takeScreenshot: payment-form

This is useful when you need screenshots of several screens or want to capture the same screens repeatedly.

Tests

MASTG-TEST-0404: Runtime Verification of Accessibility Data Sensitivity

Demos

MASTG-DEMO-0160: Runtime Accessibility Data Sensitivity of Sensitive Views with Frida