Interact Block XPath Builder

by Fran T

Version 10 (October 29, 2026)

Download (8,378 downloads)

This flow allows UI elements to be identified by class, text, and/or ID, like earlier versions of the Interact block before it was changed to use XPaths. As before, globbing (wildcards) is supported for identifying elements by text they contain.

To generate an XPath, simply give the flow any of those three identifiers as before. Often, you only need to know the element's text.

If you also/instead need to provide the element's ID or class, use the Record Interactions or Inspect Layout features of an Interact block in your flow and choose the interaction or element you're interested in. Next, look near the bottom of the XPath that was generated for elements that look like they'll uniquely identify the element. The best choice is ID, followed by element text and/or class. Using as few as necessary, copy those attribute(s) and give them to the XPath Builder flow. It'll generate a much simpler XPath that's copied to your clipboard to make it convenient to paste back into your Interact block.

𝗦𝗮𝗺𝘀𝘂𝗻𝗴 𝘂𝘀𝗲𝗿𝘀: One UI 8.5+ has removed the ability of Automate to interact with the Quick Setting tiles. If you arrange Quick Settings to be visible in the notification shade, they can be accessed by using the Notification Action of the Interact block.

Here are some sample XPath identifiers to look for to give to this flow:

button[@class="android.widget.TextView"]
-The class is android.widget.TextView

android.view.ViewGroup[@android:contentDescription='Flashlight,Off.,Button']
-The element text is Flashlight, followed by some other text. Here we'd enter "Flashlight*" when prompted for element text (better yet, use the Build Quick Setting XPath flow, which will add the necessary wildcards)

android.widget.FrameLayout[@android:id='@com.android.systemui:id/notification_panel']
-The ID is notification_panel and the app is the System UI

If the element you're interested in is an Android Quick Setting tile (such as Flashlight, Location, etc.) it's better to use its text to identify it. -The Interact block's Record Interactions feature will yield a tile's exact position in the Quick Settings panel, which will be different on different devices and Android versions, and users can move the tiles themselves. The 'Build Quick Setting XPath' and 'Test Quick Setting XPath' flows are provided for this special situation. If you specify the Hotspot or Wi-Fi tiles, the flow will generate special XPaths that will work for Samsung One UI, as well as other devices. Your flows will work on many more devices as a result.

Updates:
• Removed requirement for "read sensitive log data" permission, improved Test flow reliability
• Quick Setting paths simplified and updated for Android 14+
• Added a special case for Hotspot, updated Wi-Fi for Android 15+
• App package for ID is now optional
• Updated for newer Quick Settings UIs for Bluetooth and Wi-Fi, work around some Samsung issues, improvements to flow UI and error handling

4.8 average rating from 27 reviews

5 stars
25
4 stars
1
3 stars
0
2 stars
0
1 star
1
Reports
0

Rate and review within the app in the Community section.