Inspect View Tree is a feature that is designed to help you discover all the visible elements of your mobile application while developing your test scripts. It captures a snapshot of the user interface and allows you to navigate and inspect view objects of your native apps.
Inspect View Tree feature allows you to see, debug, analyze or determine the state of individual View components. It also informs you about global changes in the view tree.
Such global changes include, for example, a layout of the whole tree.
The feature speeds up your debugging experience of QA SDET for automated test scripts, and expedites the debugging and validating View and UI-related issues. Finally, the Inspect feature is a critical factor for easy validation of accessibility labels.
What You'll Need
- A Sauce Labs account (Log in or sign up for a free trial license)
- A native Android, iOS, or iPadOS mobile app
Using Inspect View Tree for Real Devices
By default, the Inspect View Tree feature is enabled if the instrumentation feature is enabled.
To enable device instrumentation:
- On Sauce Labs, click Live > Mobile App.
- Upload your mobile app to Sauce Labs through the UI or CLI.
- After you’ve uploaded your app, return to the Live > Mobile App page, hover your mouse over your app, then select Settings.
- Under Default Settings, toggle Instrumentation on.
Now you can start your live or automated testing session. View Tree will be captured and be part of your test results.
The Inspect View Tree feature works for all the automated test framework types.
Accessing Inspect View Tree
In Sauce Labs, click LIVE or AUTOMATED and then click Test Results.
Select a test result from the list.
Click on Inspect button.
The Inspect View Tree feature will display the captured snapshots of detectable view changes:
You can also download the results using the API call below:
curl --compressed \
Inspect View Tree Attributes
The following table lists the available attributes:
|ID||The class identifier|
|Visibility||A value that checks if the component is present in the View Tree|
|Focusable||A value that provides additional information associated with accessibility|
|Alpha||A value that describes how translucent or opaque the component is|
|Enabled||Checks the interactivity of the component|
|ContentDesc||The accessibility description of a UI component|
|Text||A text attribute of a UI component|
- Webviews and hybrid apps will have additional capture limitations.
- Emulators and Simulators are not supported.