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.

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 Selector Properties
UiPath Selector Properties

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.

Selector Editor in UiPath Studio
Selector Editor in UiPath Studio

Selector Editor provides the following options:

OptionDescription
ValidateThe 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:

 image alt text The selector is being validated
 image alt text Valid selector
 image alt text Invalid selector
 image alt text Modified selector, revalidate
Indicate ElementIt describes the replacement of an existing UI (User Interface) element with a new one.
RepairChoice 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.
HighlightThis 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 AttributesIncludes every component of the application required to identify the target application (a window, a button, etc.). This section can be changed.
Edit SelectorThe real selector is kept in it.
Open in UI Exploreropens the UI Explorer

Full Vs Partial Selectors UiPath

Now we will compare partial and full selectors in uipath.

UiPath Full SelectorsUiPath Partial Selectors
Full selectors are generated by Basic RecorderPartial selectors are generated by Desktop Recorder
Full selectors contain all information on Top Level windowPartial 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

  1. Open UiPath Studio and create a new process
  2. Drag and drop an activity that has selectors. Here we are using click activity.
  3. Click on “Indicate on screen” and select a target screen.
  4. Now click on the three dots to image alt textedit 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 Dynamic Selector
UiPath Dynamic Selector

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

  1. Open your uipath studio and create a new process
  2. Open a new Notepad file.
  3. Now drag a “Type Into activity” to your workflow.
  4. Now click on Indicate on Screen and indicate note pad screen in it.
  5. Now click on the three dots to open the Selector editor. Now the editor window will be displayed.
UiPath Wildcards
UiPath Wildcards
  1. Now open any other .txt file in notepad, where the title of notepad should be different from step 1.
  2. 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.
  3. Now you can see the editor is updated with a UiPath selector variable wildcard.
Wildcards in Selectors
Wildcards in Selectors

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 TypeSupport
<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.

Selector UiPath Regex

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.

OptionDescription
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’s aaname 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

  1. 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.

  2. 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.

  3. How many selectors are there in UiPath?

    Uipath has 3 – 4 Selectors.

  4. 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

  5. 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.