Skip to content
Last updated

A view tree (also known as a UI hierarchy or DOM tree) is a structured representation of all the visual elements currently displayed on an Android device's screen. It is the foundation for how MoreLogin RPA locates and interacts with on-screen elements.


How It Works

When an Android app renders its UI, the system creates a hierarchical tree of View objects. Each node in this tree represents a UI element — buttons, text fields, images, containers, etc.

FrameLayout
├── LinearLayout
│   ├── TextView ("Welcome")
│   └── EditText (input field)
├── RecyclerView
│   ├── ViewHolder[0]
│   │   ├── ImageView (app icon)
│   │   └── TextView ("Chrome")
│   └── ViewHolder[1]
│       ├── ImageView (app icon)
│       └── TextView ("Gmail")
└── FrameLayout
    └── Button ("OK")

MoreLogin RPA uses the Android Accessibility Service to capture this tree, converting it into a JSON structure that your workflow can query.


Element Properties

Each element in the view tree exposes these key properties:

PropertyTypeDescriptionExample
textStringVisible text displayed by the element"Chrome"
resourceIdStringAndroid resource ID (also called fullId)"com.android.launcher3:id/icon"
classNameStringAndroid view class name"android.widget.TextView"
contentDescriptionStringAccessibility description (used for screen readers)"Chrome"
packageNameStringPackage name of the app owning this element"com.android.launcher3"
boundsObjectScreen coordinates {top, right, bottom, left}{"top":261,"right":540,...}
centerX / centerYIntegerCenter point coordinates of the element405, 441
isClickableBooleanWhether the element responds to tap eventstrue
isEnabledBooleanWhether the element is interactivetrue
isVisibleToUserBooleanWhether the element is currently visible on screentrue
childCountIntegerNumber of child elements0
indexIntegerPosition index among sibling elements2

How RPA Uses the View Tree

Finding Elements

The Find Element node queries the view tree using filter conditions:

Filter ConditionDescriptionExample
textMatch by visible texttext Equals "Chrome"
fullIdMatch by resource IDfullId Equals "com.android.launcher3:id/icon"
classMatch by view classclass Equals "android.widget.Button"
descMatch by content descriptiondesc Contains "Search"

Interacting with Elements

Once an element is found, you can:

  1. Tap it — using the Tap Element node
  2. Extract data — using the Run JS Script node to read properties like text or contentDescription
  3. Loop over multiple elements — using the Loop node to iterate through a list of found elements

Inspecting the View Tree

Use the Developer Tools in MoreLogin RPA to inspect the view tree of any cloud phone screen in real time:

  1. Open the cloud phone in MoreLogin
  2. Go to RPA → Developer Tools
  3. The view tree panel shows all elements on the current screen
  4. Click any element to see its properties (text, resourceId, bounds, etc.)

For more about Developer Tools, see Developer Tools.


Tips

  • Use resourceId for stable matching: Text content may change across languages or app updates, but resourceId values are usually stable.
  • Combine multiple conditions: Use text + class together when resourceId is not available.
  • Check isVisibleToUser: Elements may exist in the tree but be off-screen. The Find Element node only returns visible elements by default.
  • Wait for elements: Screens may take time to load. Use the Maximum Wait Time parameter in Find Element to poll until the element appears.