Skip to main content

Inspect View Tree

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.

note

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

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:

  1. On Sauce Labs, click Live > Mobile App.
  2. Upload your mobile app to Sauce Labs through the UI or CLI.
  3. After you’ve uploaded your app, return to the Live > Mobile App page, hover your mouse over your app, then select Settings.
    Mobile app settings navigation
  4. Under Default Settings, toggle Instrumentation on.
    Mobile app settings navigation

Now you can start your live or automated testing session. View Tree will be captured and be part of your test results.

note

The Inspect View Tree feature works for all the automated test framework types.

Accessing Inspect View Tree

You can access the Inspect View Tree from the Live Test Results or Automated Test Results page.

  1. In Sauce Labs, click LIVE or AUTOMATED and then click Test Results.


    Mobile app settings navigation
    Mobile app settings navigation
  2. Select a test result from the list.


    Mobile app settings navigation
  3. Click on Inspect button.


    Mobile app settings navigation

The Inspect View Tree feature will display the captured snapshots of detectable view changes:


Mobile app settings navigation

You can also download the results using the API call below:

 curl --compressed \
-O https://{SAUCE_USERNAME}:{SAUCE_ACCESS_KEY}@{DATA_CENTER}.saucelabs.com/v1/rdc/jobs/{JOB_ID}/insights.json

Inspect View Tree Attributes

The following table lists the available attributes:

NameDescription
IDThe class identifier
VisibilityA value that checks if the component is present in the View Tree
FocusableA value that provides additional information associated with accessibility
AlphaA value that describes how translucent or opaque the component is
EnabledChecks the interactivity of the component
ContentDescThe accessibility description of a UI component
TextA text attribute of a UI component

Limitations

note
  • Webviews and hybrid apps will have additional capture limitations.
  • Emulators and Simulators are not supported.

More Information