In this tutorial, we will be discussing UiPath Selectors which will come across your automation process in UiPath. One of the best features of uipath is it provides a selector to select images, text, applications, and browsers during your automation process.
Here you will learn a detailed overview of UiPath Selector Variables. we will include every penny of knowledge in this section that you will require in your process. So let’s go through it.
Table of Contents
What are UiPath Selectors
During UiPath Automation, to automate particular actions in UI (User Interface) you have to interact with buttons, Application windows or browsers, and other UI Elements. To Identify the mentioned UI Element you can use it by providing the position of the screen. But it’s not easy and it’s not a good method. This is where selectors come into the role.
UiPath Selectors are used to store GUI (Graphical User Interface) elements in form of XML (extensible markup language) in UiPath Studio.
While Automating process in UiPath Studio, Selectors are automatically used by UiPath Studio and do not require human input. Since these apps have static interfaces.
But if you are performing automation in a dynamic window, since its elements are changing according to the response, here you have to manually use selectors. These manual processes are down in web apps or browsers.
The structure of a selector is:
<node_1/><node_2/><node_3/>......<node_N/>
<ui_system attr_name_1='attr_value_1' ... attr_name_N='attr_value_N'/>
Selector values or data are stored in the properties panel. To see the selector details of the activity you can click that activity goes check its properties section. Here we are showing an example of click activity.
![UiPath Selectors: Best Practices For UiPath Automation UiPath Selector Properties](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixDE-4D9_1CzhHHHzGqqU2_VmaiQ15pe45m6VEb_Bw09BfFvOse2RRpRdolrgdNLwNSnguyqjnpNbwN0FzOchS4OWWHhjNhd4VEKqj_xEZVL1kUTcnd8gixV4u0SDXhQxM2rGy05hBCpL-M_7P0h8YDiD5i-dF3nC8V59zwFFQfdo22bqvEGwv1IoFEA/s16000-rw/UiPath%20Selectors%20in%20Properties%20section.webp)
An Overview of UiPath Selector Editor
The Selector Editor allows you to edit and see automatically generated selectors. You can change or modify existing selectors and highlight already selected selectors in UiPath Studio.
![UiPath Selectors: Best Practices For UiPath Automation Selector Editor in UiPath Studio](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9G2aaXFqUeBb-Daqv8pp8cK8RgtsiTFZbtUnn_eKJQDy3hPNMeTlMM4s6KKALYFWI_9Rj2tinfAkgiWhZp-mY_Qj5uTAUWz6kMItN8hoevblL-sGn6jCpT016dG7R1gOvP-V6ofIoyGn1afxbZ_sohYBmMM4a_bRYSOxk18JqtCHE2Tn4tUMwOfKD1w/s16000-rw/UiPath%20Selector%20Editor.webp)
Selector Editor provides the following options:
Option | Description |
---|---|
Validate | The Validate button verifies that the selector definition is valid and that the target element is visible on the screen to display the status of the selector.. The Validate button provides three options: ![]() ![]() ![]() ![]() |
Indicate Element | It describes the replacement of an existing UI (User Interface) element with a new one. |
Repair | Choice of repair makes it possible for you to fix the selection and re-indicate the same target UI element. Although it partially replaces the prior selection, this procedure. Only when the selection is invalid is the button accessible. |
Highlight | This button allows the relevant component into focus. Unless the option is deactivated with a click, the highlight remains active. Only if the choice is correct is the button activated. |
Edit Attributes | Includes every component of the application required to identify the target application (a window, a button, etc.). This section can be changed. |
Edit Selector | The real selector is kept in it. |
Open in UI Explorer | opens the UI Explorer |
Full Vs Partial Selectors UiPath
Now we will compare partial and full selectors in uipath.
UiPath Full Selectors | UiPath Partial Selectors |
---|---|
Full selectors are generated by Basic Recorder | Partial selectors are generated by Desktop Recorder |
Full selectors contain all information on Top Level window | Partial selectors do not contain information on Top Level window |
Full selectors are recommended to use when switching between multiple windows in uipath studio. | Partial selectors recommended using it when performing various actions in the same window in the UiPath studio |
UiPath Dynamic Selectors
In Dynamic Selector In UiPath, we use variables or arguments as a property. It allows the Selector to identify a target element based on the UiPath Selector variable or arguments.
Dynamic Selector In UiPath does not use exact strings as they can change over user interactions. So it allows interaction with the application with a different element without changing the UiPath Selector. It is commonly used in dynamic applications or browsers.
Dynamic selectors can have the following forms:
- tag – Eg:
<ctrl/>
- attribute – Eg:
name='menuItem'
- {{Value}} – The name of the argument or variable that has the properties of the element which you want to interact with.
<tag attribute=`{{Value}}` />
Example of How to Create Dynamic Selectors in UiPath Studio
To check UiPath dynamic selectors you can use both variables and arguments. Here to show an example we are using variables. Here in this example, we are showing how to add variables in the selector UiPath
- Open UiPath Studio and create a new process
- Drag and drop an activity that has selectors. Here we are using click activity.
- Click on “Indicate on screen” and select a target screen.
- Now click on the three dots to
edit the selector. When the selector opens it will show like this
<wnd app='notepad.exe' cls='Notepad' title='Untitled - Notepad' />
<ctrl automationid='MenuBar' idx='1' name='Application' role='menu bar' />
<ctrl name='File' role='menu item' />
By default, the selector has the above values. Now we are going to change the "ctrl name
” to a variable name. To add a selector uipath variable use can use the keyboard short key Ctrl + K. After changing the above code to a variable it will look like this:
<wnd app='notepad.exe' cls='Notepad' title='Untitled - Notepad' />
<ctrl automationid='MenuBar' idx='1' name='Application' role='menu bar' />
<ctrl name='{{MenuOption}}' role='menu item' />
![UiPath Selectors: Best Practices For UiPath Automation UiPath Dynamic Selector](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-GjMRvvs9Hs7JgX_ApyRmquZqXP00c9W_xOw_d7f1twcjJS6ZFFOYya_Z9ypZsLAju5MggsiAdUgOlT86Lb8VMf31_UT3BpME5D3a8WoX-SupAK4m1bpDz6SCCjNIVHKG9ZDWF16Gye5r-5X478B1CMcVbYADvs0FEgvbD4WiUzU7Nm69J7kUZfHEmQ/s16000-rw/Dynamic%20Selector%20in%20UiPath.webp)
UiPath Selector WildCards
A string can have zero or more characters replaced using wildcard symbols. When working with selectors that have dynamically changing characteristics, this might be extremely helpful.
- Asterisk (*) – It helps to replace zero (0) or more characters
- Question mark (?) – It helps to replace a single character
Example of Generating UiPath Selector Wildcards
- Open your uipath studio and create a new process
- Open a new Notepad file.
- Now drag a “Type Into activity” to your workflow.
- Now click on Indicate on Screen and indicate note pad screen in it.
- Now click on the three dots to open the Selector editor. Now the editor window will be displayed.
![UiPath Selectors: Best Practices For UiPath Automation UiPath Wildcards](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj9YIW97n2c97LZE_KvgCL9t_gCRaxiYo7XJtl87voP2Tg_aku_By9l9XPwm9wlIJYpTbFNbuvHD2asw20B3bSdoNlcQEH8tJXyrL9XdiWe_9-kEfX0cLeiWA3HUfSHB2BpbgISev-4ML3jKwG79TaU1r4p56a1dFoigCN2z2LbsCARuh335uj-OB4Tg/s16000-rw/UiPath%20Before%20Selector%20Wildcards.webp)
- Now open any other .txt file in notepad, where the title of notepad should be different from step 1.
- Now on Selector Editor click on Repair and indicate the notepad screen. Now a message box will be popped saying “Selector was Updated to Live Element“. Now click ok.
- Now you can see the editor is updated with a UiPath selector variable wildcard.
![UiPath Selectors: Best Practices For UiPath Automation Wildcards in Selectors](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw3qc36BMEs9C4u1DBNs8hDcum4z3JvDYWq0qq0Ty9zyFAm3efOyQ2pQ79d04pVYdc7FvvP9FiE1SlzrXfEHQ4tCofw20RwYjcNQvTIzafyDAAmVBCPwtiLnlsvURsYUSzPYwR2V_RjVcaRvJ-tBErXDhikBzYVUgYEqpDi-v7zoQhAOwHB5Qa62N0pQ/s16000-rw/UiPath%20Selector%20Wildcards.webp)
UiPath Fuzzy Selector
A top-level tag in a selection refers to the target window or browser tab. The information it contains, like title, process name, URL, window name, and others, makes it easier for you to recognize the components you wish to employ in your automation applications.
Top-level tag values frequently undergo dynamic modifications as a result of the target application rewriting them in response to your activities. For instance, throughout the automation process, a web page title may change, invalidating the matching selection.
In this way, you may identify strings based on a pattern rather than an exact match to your input thanks to the selector’s fuzzy search capabilities. As a consequence, items may be identified in more flexible ways, and selectors are validated based on a variety of qualities, even if some are subject to change throughout the automation process.
Selector Type | Support |
---|---|
<wnd> | ✔️ |
<html> | ✔️ |
<webctrl> | ✔️ |
<java> | ✔️ |
<ctrl> | ✔️ |
<sap> | ✔️ |
<rdp> | ✔️ |
<silverlight> | ❌ |
Tags that identify a process name. Example: <html app="firefox.exe"> | ❌ |
UiPath Selector RegEx
You can also select UI elements using RegEx which is known as Regular expression. It is used to describe the pattern of a string. To know more you can check the below link.
UiPath Selector Case Sensitive
The Case-Sensitive property allows for the identification of items when a selector is created by additionally taking into account the case of an attribute’s value.
Option | Description |
---|---|
casesensitive:<attribute-name>='true' | It helps you to enable and to validate a selector |
UiPath Selectors Best Practices
Now we will check what are the best practices to use these selectors in UIPath Studio. So that maximum errors can reduce while running your process. These are just recommendations that can help you to create a better selector for your automation process.
Following the recommended practices that help to create a better selector in UIPath Studio:
- To improve your variable, use UiPath Explorer and navigate the visual tree.
Use the selector’saaname
property to match the fields’ visible names or labels. - If an element’s name changes based on input data dynamically, use variables.
- If you can, try to stay away from class attributes.
- Use of CSS selectors or other page style characteristics should be avoided (to avoid impact to the Robots due to any appearance changes)
- Use of the UiPath Selector IDX property should be avoided since it is a dynamic variable that varies based on when an element loads on a page.
- If there is a choice, utilize it; otherwise, avoid using OCR for selectors.
- The number of modifications to top-level selectors can be reduced by using Attach browser or Attach window Activities.
- Replace hardcoded selections in the attached browser activity using browser variable input.
- The UI library Application interaction: If the concerned program changes its user interface (UI) regularly, think about creating a library and including all the Activities that interact with its UI there. The library may then be updated to reflect UI changes by referencing the most recent version in the UiPath Project’s dependencies, which uses this program.
UiPath Selector is Not Valid Error Fix
while running robots in UiPath Studio you may get an error like this. To fix this problem you can use any one of the methods below.
➊ Check the Selector: Check your already configured selector. you can edit the selector and validate the element to check if it is ok or not.
➋ Use Wildcards: you can also use wildcards so that the above problem does not occur. You can use Asterisk (*)
➌ Use Anchor Base: Try different UiPath Selector Anchor bases to make sure that the current element is not conflicting with other UI Elements.
➍ Check for Changes in UI: Sometimes due to dynamic UI your selector element has changed so re-select the UI Element.
UiPath Selector Not Found Exception Error Fix
To fix the exception problem in the selector you can follow below steps:
➊ Delay a moment as it navigates to the next page.
➋ Use dynamic selectors for dynamic elements.
Conclusion
So far we have gone through a detailed overview of selectors in uipath. You can use this knowledge in your uipath automation process for improving the overall efficiency of your workflow. Here we have also provided the best practice methods to use these selectors in your project.
If you can any doubts about this section you can ask in our comment section.
Also check, UiPath
Faq on UiPath Selectors
-
What is a selector UiPath?
u003cstrongu003eUiPath Selectorsu003c/strongu003e are used to store GUI (Graphical User Interface) elements in form of XML (extensible markup language) in UiPath Studio.
-
What is dynamic selector UiPath?
A Dynamic Selector UiPath uses arguments or variables as a property for attributes tag in uipath studio. So it allows finding the target element easily based on arguments or variable values.
-
How many selectors are there in UiPath?
Uipath has 3 – 4 Selectors.
-
What are selectors and wildcards in UiPath?
Selectors are used to identify UI Elements and Wildcards are symbols that help you to replace zero or more than one character in a string
-
What is a fuzzy selector in UiPath?
Fuzzy Selector in UiPath is used to locate or identify strings based on patterns not by the exact match of user input.