Automate

Automate

Make your phone or tablet smarter with automation

Get it on Google Play

Inspect layout

A decision block that allows inspection of the on-screen user interface layout.

If the proceed option is set to Immediately, then UI layout is evaluated for the currently “active” window without pausing the fiber. If set to When UI layout changed, then the fiber will pause until the UI layout has changed and evaluation produced a result.

The XPath expression, if specified, is used to evaluate the UI layout, e.g. to select a particular UI element and/or extract a attribute of it, custom graphics as used in browsers and games will likely not work. When passing text as string literal use the xpathEncode function to ensure proper quote character escaping. The “context node” (.) is the entire UI layout document of the “active” window when using proceed Immediately, or the UI element that changed when using proceed When UI layout changed.

The YES path is executed when the evaluated result is a Number, a String, a Boolean true, a selected Node or a nonempty Node-set. The NO path for a Boolean false, or when using proceed Immediately, not selected a Node or an empty Node-set.

UI layout XML

The element “tag” name is the UI element view class. Attribute availability depends on type of UI element and Android version, see table below. Use the Inspect layout button to view the XML layout of a window shown on screen.

AttributeValueDescription
@android:checkablebooleanCan display a check mark
@android:checkedbooleanChecked state
@android:choiceModetextChoice behavior for collection (Android 5+)
@android:clickablebooleanReacts to clicks
@android:columnCountnumberColumn count of collection (Android 5+)
@android:contentDescriptiontextAssociated content description
@android:contextClickablebooleanReacts to context clicks (Android 6+)
@android:editablebooleanHas an input method (Android 4.3+)
@android:enabledbooleanAllows interaction
@android:errortextError text (Android 5+)
@android:focusablebooleanCan take focus
@android:focusedbooleanCurrently has focus
@android:hinttextHint text (Android 8+)
@android:idtextIdentifier name (Android 4.3+)
@android:inputTypetextAllowed type of text input, separated by '|' (Android 4.4+)
@android:labelFortextIdentifier name of element it’s a label for (Android 4.3+)
@android:labeledBytextIdentifier name of label element (Android 4.3+)
@android:layout_columnnumberColumn index of collection item (Android 5+)
@android:layout_columnSpannumberColumn span of collection item (Android 5+)
@android:layout_height(number)Height
@android:layout_rownumberRow index of collection item (Android 5+)
@android:layout_rowSpannumberRow span of collection item (Android 5+)
@android:layout_width(number)Width
@android:layout_x(number)Horizontal position on screen
@android:layout_y(number)Vertical position on screen
@android:longClickablebooleanReacts to long clicks
@android:maxnumberMaximum value for range (Android 5+)
@android:maxLengthnumberMaximum length of text input (Android 5+)
@android:minnumberMinimum value for range (Android 5+)
@android:passwordbooleanInput characters displayed as password dots
@android:progressnumberCurrent value of range (Android 5+)
@android:rowCountnumberRow count of collection (Android 5+)
@android:scrollablebooleanCan scroll
@android:selectedbooleanCurrently selected

Record interaction

If the floating record window doesn’t generate an event, e.g. when clicking a button, it’s likely due to the UI layout XML changing before its XPath expression can be created. A workaround is to instead use the search feature (magnifying glass icon) to pick the UI element shown on screen, then change the action, e.g. to Click.

On Android 11+ the record interactions and inspect layout windows are hidden on system Settings unless the Allow screen overlays on settings option is enable in system Developer settings.

Note! The XML of a layout can be very large, avoid using result type Node and Node-set that selects entire elements, to then parse and process them using blocks/functions, instead let the XPath do most of the “processing” to limit the result to a Boolean or the value of a specific attribute.

Options

  • Proceed — when the fiber should proceed.

Input arguments

  • Package — package name of the app displaying the UI, default is any.
  • XPath expressionXPath expression for evaluating the UI layout, default is '.', i.e. the “context node”.
  • Result type — type of result the XPath expression should produce, default is Node.

Output variables

  • Result — variable to assign the result of the evaluated XPath expression, either null, a number, a text, or an array thereof for Node-set. Nodes will be serialized to XML.

Layout

  • Inspect layout — save the UI layout of a screen as an XML file, then view it.
Note! This documentation is also accessible within the app from Help & feedback menu.