- Overview
- UI Automation
- About the UI Automation activity package
- Applications and technologies automated with UI Automation
- Project compatibility
- UI-ANA-016 - Pull Open Browser URL
- UI-ANA-017 - ContinueOnError True
- UI-ANA-018 - List OCR/Image Activities
- UI-DBP-006 - Container Usage
- UI-DBP-013 - Excel Automation Misuse
- UI-DBP-030 - Forbidden Variables Usage In Selectors
- UI-DBP-031 - Activity verification
- UI-PRR-001 - Simulate Click
- UI-PRR-002 - Simulate Type
- UI-PRR-003 - Open Application Misuse
- UI-PRR-004 - Hardcoded Delays
- UI-REL-001 - Large Idx in Selectors
- UI-SEC-004 - Selector Email Data
- UI-SEC-010 - App/Url Restrictions
- UI-USG-011 - Non Allowed Attributes
- UX-SEC-010 - App/Url Restrictions
- UX-DBP-029 - Insecure Password Use
- UI-PST-001 - Audit Log Level in Project Settings
- UiPath Browser Migration Tool
- Clipping region
- Computer Vision Recorder
- Remote UI Automation design (Live authoring)
- Activities index
- Activate
- Anchor Base
- Attach Browser
- Attach Window
- Block User Input
- Callout
- Check
- Click
- Click Image
- Click Image Trigger
- Click OCR Text
- Click Text
- Click Trigger
- Close Application
- Close Tab
- Close Window
- Context Aware Anchor
- Copy Selected Text
- Element Attribute Change Trigger
- Element Exists
- Element Scope
- Element State Change Trigger
- Export UI Tree
- Extract Structured Data
- Find Children
- Find Element
- Find Image
- Find Image Matches
- Find OCR Text Position
- Find Relative Element
- Find Text Position
- Get Active Window
- Get Ancestor
- Get Attribute
- Get Event Info
- Get From Clipboard
- Get Full Text
- Get OCR Text
- Get Password
- Get Position
- Get Source Element
- Get Text
- Get Visible Text
- Go Back
- Go Forward
- Go Home
- Google Cloud Vision OCR
- Hide Window
- Highlight
- Hotkey Trigger
- Hover
- Hover Image
- Hover OCR Text
- Hover Text
- Image Exists
- Indicate On Screen
- Inject .NET Code
- Inject Js Script
- Invoke ActiveX Method
- Key Press Trigger
- Load Image
- Maximize Window
- Microsoft Azure Computer Vision OCR
- Microsoft OCR
- Microsoft Project Oxford Online OCR
- Minimize Window
- Monitor Events
- Mouse Trigger
- Move Window
- Navigate To
- OCR Text Exists
- On Element Appear
- On Element Vanish
- On Image Appear
- On Image Vanish
- Open Application
- Open Browser
- Refresh Browser
- Replay User Event
- Restore Window
- Save Image
- Select Item
- Select Multiple Items
- Send Hotkey
- Set Clipping Region
- Set Focus
- Set Text
- Set To Clipboard
- Set Web Attribute
- Show Window
- Start Process
- System Trigger
- Take Screenshot
- Tesseract OCR
- Text Exists
- Tooltip
- Type Into
- Type Secure Text
- Use Foreground
- Wait Attribute
- Wait Element Vanish
- Wait Image Vanish
- Accessibility Check
- Application Event Trigger
- Block User Input
- Check/Uncheck
- Check App State
- Check Element
- Click
- Click Event Trigger
- Drag and Drop
- Element Scope
- Extract Table Data
- Find Elements
- For Each UI Element
- Get Browser Data
- Get Clipboard
- Get Text
- Get URL
- Go to URL
- Hide Status Window
- Highlight
- Hover
- Inject Js Script
- Keyboard Shortcuts
- Keypress Event Trigger
- Mouse Scroll
- Navigate Browser
- Save Image
- Select Item
- Set Browser Data
- Set Clipboard
- Set CV Server
- Set Runtime Browser
- Set Focus
- Set Project Setting
- Set Text
- Show Status Message
- Show Status Window
- Take Screenshot
- Type Into
- Unblock User Input
- Window Operation
- Perform browser search and retrieve results using UI Automation APIs
- Web Browsing
- Find Images
- Click Images
- Trigger and Monitor Events
- Create and Override Files
- HTML Pages: Extract and Manipulate Information
- Window Manipulation
- Automated List Selection
- Find and Manipulate Window Elements
- Manage Text Automation
- Load and Process Images
- Manage Mouse Activated Actions
- Automate Application Runtime
- Automated Run of a Local Application
- Browser Navigation
- Web Automation
- Trigger Scope Example
- Enable UI Automation support in DevExpress
- Computer Vision Local Server
- Mobile Automation
- Release notes
- About the mobile device automation architecture
- Project compatibility
- Get Log Types
- Get Logs
- Get Page Source
- Get Device Orientation
- Get Session Identifier
- Install App
- Manage Current App
- Manage Other App
- Open DeepLink
- Open URL
- Mobile Device Connection
- Directional Swipe
- Draw Pattern
- Positional Swipe
- Press Hardware Button
- Set Device Orientation
- Take Screenshot
- Take Screenshot Part
- Element Exists
- Execute Command
- Get Attribute
- Get Selected Item
- Get Text
- Set Selected Item
- Set Text
- Swipe
- Tap
- Type Text
- Terminal
- Release notes
- About the Terminal activity package
- Project compatibility
- Best practices
- Find Text
- Get Color at Position
- Get Cursor Position
- Get Field
- Get Field at Position
- Get Screen Area
- Get Text
- Get Text at Position
- Move Cursor
- Move Cursor to Text
- Send Control Key
- Send Keys
- Send Keys Secure
- Set Field
- Set Field at Position
- Terminal Session
- Wait Field Text
- Wait Screen Ready
- Wait Screen Text
- Wait Text at Position
- Terminal coded automation APIs
Navigation tag
The nav selector tag, used to target an element by navigating from the element matched by the rest of the selector.
About the nav tag
A navigation tag, <nav />, navigates in the UI tree from the element matched by the preceding tags to a related element (its parent, one of its siblings, or one of its children), using one of its attributes. Navigation tags work best when the element you want has no stable attributes of its own, but a nearby element does.
For example, a list item might have no reliable name, while the list that contains it does. You can target the list by its attributes, then use a navigation tag to reach the item by its position.
Attributes
Each attribute takes a whole number that sets how far to move.
| Attribute | Moves to | Accepted values |
|---|---|---|
up | An ancestor of the current element. up='1' is the parent, up='2' the parent of the parent, and so on. | 1 or greater |
next | A following sibling. next='1' is the next sibling. | 1 or greater |
prev | A preceding sibling. prev='1' is the previous sibling. | 1 or greater |
child | A child of the current element, by position. Positive values count from the first child (child='1' is the first child). Negative values count from the last child (child='-1' is the last child, child='-2' the second to last). | Any whole number except 0 |
The child attribute is available starting with UiPath.UIAutomation.Activities 26.10.8.
How navigation tags work
A navigation tag starts from the element that the tags before it have reached. Then:
- A navigation tag can be the last tag in a selector. The selector then targets the element the tag lands on.
- If another tag follows a navigation tag, that tag searches the descendants of the element the navigation tag landed on.
- You can chain several navigation tags. Each one starts from where the previous one landed.
Each navigation tag should use one attribute. If a tag has more than one attribute, the moves are applied in this order: up, next, prev, child.
Which elements count as children and siblings
The children of an element are the same elements shown under that element in the UI Tree: elements of a single UI technology, in tree order, including hidden elements. Siblings are the other children of the same parent.
When the current element is a window (<wnd>), its children come from the first UI technology that has children for that window.
When a navigation fails
The selector returns a navigation error in these cases:
- The value is
0, for examplechild='0'orup='0'. - The value points past the available elements, for example
child='5'on an element with three children, ornext='2'on the last sibling but one. - The value is not a number. In this case the selector fails when it is parsed.
Versions earlier than UI Automation v26.10.8 also return a navigation error for selectors that use the child attribute.
Navigation tags in searches that return multiple elements
In activities that look for all matching elements, a navigation tag returns the single element it lands on.
Examples
Target the last item of a list whose length changes
The selector always targets the last message, however many messages the list contains. When a new message is added, the selector moves to it.
<wnd app='app.exe' /><uia name='Messages' role='list' /><nav child='-1' />
<wnd app='app.exe' /><uia name='Messages' role='list' /><nav child='-1' />
Target the second to last item
<wnd app='app.exe' /><uia name='Messages' role='list' /><nav child='-2' />
<wnd app='app.exe' /><uia name='Messages' role='list' /><nav child='-2' />
Target the first child of an element
<wnd app='app.exe' /><uia name='Messages' role='list' /><nav child='1' />
<wnd app='app.exe' /><uia name='Messages' role='list' /><nav child='1' />
Target the parent of an element with a stable label
<html app='chrome.exe' title='Orders' />
<webctrl tag='SPAN' innertext='Order total' />
<nav up='1' />
<html app='chrome.exe' title='Orders' />
<webctrl tag='SPAN' innertext='Order total' />
<nav up='1' />
Target the element next to a label
The selector finds a label, then moves to the sibling that follows it, such as the value field shown next to the label.
<html app='chrome.exe' title='Orders' />
<webctrl tag='SPAN' innertext='Order total' />
<nav next='1' />
<html app='chrome.exe' title='Orders' />
<webctrl tag='SPAN' innertext='Order total' />
<nav next='1' />
Chain navigation tags
The selector moves up to the row that contains the label, then to the third child of that row.
<html app='chrome.exe' title='Orders' />
<webctrl tag='SPAN' innertext='Order total' />
<nav up='1' />
<nav child='3' />
<html app='chrome.exe' title='Orders' />
<webctrl tag='SPAN' innertext='Order total' />
<nav up='1' />
<nav child='3' />
Search inside the element a navigation tag lands on
The tag after the navigation tag searches only within the last row of the table.
<html app='chrome.exe' title='Orders' />
<webctrl tag='TABLE' id='orders' />
<nav child='-1' />
<webctrl tag='BUTTON' innertext='Edit' />
<html app='chrome.exe' title='Orders' />
<webctrl tag='TABLE' id='orders' />
<nav child='-1' />
<webctrl tag='BUTTON' innertext='Edit' />
Navigation tags compared with the idx attribute
The idx attribute counts all matching elements among the descendants of the current element. When content is added or removed, the same idx value can point to a different element.
A navigation tag with child counts only the direct children of a known element, and negative values count from the end. Use child when the position you care about is fixed relative to the start or the end of a list, such as the first or the last item.
Platform support
| Attribute | Windows | Cross-platform |
|---|---|---|
up | Supported | Supported |
next | Supported | Supported starting with 26.10.8 |
prev | Supported | Supported starting with 26.10.8 |
child | Supported starting with 26.10.8 | Supported starting with 26.10.8 |
| Navigation tags in searches that return multiple elements | Supported | Supported starting with 26.10.8 |
Before 26.10.8, selectors that used next, prev, or navigation tags in searches that return multiple elements worked in Windows projects but failed in cross-platform projects.
- About the nav tag
- Attributes
- How navigation tags work
- Which elements count as children and siblings
- When a navigation fails
- Navigation tags in searches that return multiple elements
- Examples
- Target the last item of a list whose length changes
- Target the second to last item
- Target the first child of an element
- Target the parent of an element with a stable label
- Target the element next to a label
- Chain navigation tags
- Search inside the element a navigation tag lands on
- Navigation tags compared with the idx attribute
- Platform support