How to use variables in selectors in Studio (dynamic selectors) without string manipulation!

This tutorial will teach you how to easily use variables in your selectors. In other words, we will be making dynamic selectors without the use of the old method of concatenating strings. How cool is that! :slight_smile:

For the purpose of this tutorial, I will make 1 click in the Notepad app.

Feel free to also reference our documentation here.

Let’s begin!

1. First, we will indicate the element we want to click on. In this case, it will be File menu in Notepad:


This results in the following selector:

2. Now, let’s select the attribute value we want to change:


3. Let’s right click that attribute value for a bunch of options. In our case, we will select “Create Variable”:


4. From here, let’s give our variable a name and a default value:

And confirm it with Enter.
We will now have the new variable added instead of the previous property value:


When we Validate our selector, it should turn green:
There we go!

5. Let’s click OK to save our changes…

Here you can see the final workflow:

And this is how to make your selector dynamic :slight_smile:

Note 1 The variables/arguments need to be of type String or Int32. GenericValue type is not supported for the selector variables.
Note 2 The selector variable will take a default value if no other value is set in the workflow. As a result, it will throw an error if the value was not set and the default value is not set. Additionally, the Selector will use the Default value for validation at Design Time, but it will use the current value of the variable at Runtime.

If you want to give it a try, please check out this sample project here: (13.7 KB)

How to usee variable in selectors
Pass variable to click on text from list
Insert variable into selector
How define Selector variable
How to pass Variable into Selectors
How can i click on country name Dynamically with input as country namr from one variable
How to add wildcard in aaname category of a click function
Table count
Detect Text Location and Fill Textbox on Web Browser Dynamically
How to Count the Number of Product Images on Amazon
Detect color from website
Read dynamic elements in webpage and click matching text
How to use Argument in Selector
Loop in listview
AnyTeller Selector Variable Error
Why " becomes " when passing variable into selector?
How click in multiple link
How to select a provided year in Amazon orders? Not getting the correct element
Current selector is invalid error
Add variable in selector
Variable in selector not working
Using a variable in a selector
Count the number of rows on the web application
Difficulties pass variable through selector
Remove all elements from list
Enter in a Cloud and for each project, download file, and rename it
#FeatureBlog - 19.10 - Fuzzy string matching for your selectors
Double Quote "'^<>& in Uipath
Become one of our product experts and share your knowledge! :)
Hi, Is it possible to provide value to Find Element activity from excel. Data I am using may have multiple results and I need that only data I have put in excel should be clicked
How to Use Variable in Selector to Activate specific window
Changing Variable Value in Checkbox Selector
How to process web page to click on the right button?
Getting UI selector error
Check the next blank documents using send hotkey
How to spy the values which changes continuously
Selector stable
How to set dynamic selector
Converting Extract Structured data Selector to variables
How to handle update data into the dynamic field
Get data from each row in web
Click text activity not working
Scraping web with icon
Click on search item
Handing dynamic selectors
Dynamic selector table row based on searched word
How to get selector via text value
How to add string to a selector variable?
Click Web table by statuses
Print selector content to logging
Click on specific Ui Element in table
Can we use a variable or argument inside the "UI Explorer" for the selector?
Want to put variable
Set variable in selector
Recording in SAP - How to select option when scrolling necessary in pop up window
Problem about idx element
How to define a dynamic selector for an href element
Does anyone use UiPath with SAP report and stuck with
Loop Through and Click Through the Tickets in Browser
Click link in a table based on value in another column
Click link in a table based on value in another column
Click link in a table based on value in another column
How to Click on a Number in the Table as Dynamic Selector
How to select range date form drop down list in Uipath
Get image from accounts (dynamically)
How to click the row which is highlited with green color?
How to use hover click and click text (with dynamic text)?
Find Children Selector Error (+row+)
Need help in setting variable in selector
Web application selectors issue
Detect if an Excel file is read-only
Table Row on Web App is not consistent
Dynamically Creating Selector Values
Selector in a variable
How to implement dynamic IDX using the loops index?
I was implementing the reservation as a uipath, but it was blocked
Moving target
How to Make Selector Dynamic in Mobile Automation?
How to click on each name of web page
Selector for UiPath Studio Changes
Using a dynamic varibale in selector and get the value from Config file
How to use a switch on the button?
Can we create string as variable
Click text?
Data Scrapping output issue
How to use a variable in Selector?
Switch between Selector Editor and Expression Editor
Variable in selector
Pass variables to click on a text in a Java app!
Selector Type Into Activity in web-app
Select a pay period end date dynamically
How to modify selector to click on a specific folder?
Find Children and Bad Selector
Wildcard not working for "tag" attribute
I have to click on the matching value in the web page
Datatable wont iterate through links. Can't add column data. Please Help
Multiple download buttons in table
Sector get text activity from pdf with multiple pages
String Value In Find Element
Increase index number
Generating IDs Dynamically
Can we add customized selector for Element
What are the ways to overcome or reduce selector problem?
Is there a way to automatically create a post and publish it on a Facebook page?
Trying to make <ctrx idx dynamic selectors
How to pass variables in selectors
How to use a variable in: <webctrl aaname=VARIABLE />




Super. We can create dynamic selectors easily and no need to worry about syntax and all. It will be very helpful to the new users. Many people are facing issues with creating dynamic selectors and now this will be very helpful to them.


Is it new feature ? Will it work in all uipath Studio versions ?


I thinks it is in Studio for quite some time already, since 2019.4 if I’m not wrong.


neat! thanks for reminding me of this, had forgotten it was added!


I was expecting this for a long time
you are awesome @loginerror


Variables are available since 19.4. Arguments have been added in 19.8.


Thanks, it really looked good but for me it’s simply taking the variable name inside braces and not the actual value which the variable has.
Sure, I might be doing something wrong

Please make sure the scope of the variable is correct (= the activity can ‘see’ the variable). Otherwise, a small project that reproduces the issue would be appreciated :slight_smile:


I am only seeing choose/create variable in the context menu, but in my case I am trying choose an argument, which I see as an option in your screenshot. Any settings that I need to change?

Edit: Just to be clear, I do understand that I can assign the value of the argument to a variable and accomplish the same thing, just trying to do it in the cleanest way possible.

Great post, I usually use string manipulation and I think this way takes less steps and it’s easier to read. Thank you!


Hi @jcarr79

Argument support was added in 2019.8, I think. What is your Studio version? :slight_smile:


Thanks @loginerror - that’s definitely why :slight_smile:


This is awesome. Though it’s being available for quite a long time, today only I knew that this can be done. It’s really helpful in getting dynamic selectors done.

Thank you so much for sharing this tutorial… you are awesome



I have not used this yet, but I have a question, and a very important one :smiley:
I also am not sure if this has maybe been answered before.

Can you use .net to manipulate the value as you use the variable?
For example, let’s say menuOption is of type Date, can you use {{menuOption.ToString("MM-dd-yy")}}

This is pretty important, atleast in my opinion. You can’t expect us to have multiple variables for the same value of slight manipulations, everytime we want to use it in a selector. :wink:


Hi @ClaytonM

I believe your go to for now would be to re-assign the string manipulation to the same variable just before using it in the selector.

It’s a valuable feedback though, I tracked it and it will be considered :slight_smile:

1 Like

Interesting and I missed this update.

Such a great feature. :slight_smile:

1 Like

Very Interesting

1 Like

Hi @ loginerror

How can we use idx value dynamically using same method?

can you suggest any method for me use?

when i was scrape the data every time idx was changing? can i give dynamic idx or not?