What are dynamic variables:
In programming, a dynamic variable is a variable whose address is determined when the program is run. In contrast, a static variable has memory reserved for it at compilation time.
Going by the same concept, It’s necessary most of the times to dynamically create a selector based on some values obtained from previous steps in your process. Hence, this basic tutorial will help to understand how to use dynamic variables in the selectors in UiPath
For the purpose of simplicity, we will use Notepad app as the application of choice. Our use case will be, we want to use the same “Click” activity to click on all the items in menu bar using a dynamic variable. So in essence, we would spy one button on the menu bar, and make it dynamic and let it accept the button name from the code itself
Step 1: Indicate the element you want to click on. In this case, it will be File menu in Notepad:
When you spy the File button, you will get a selector as below:
Step 2: Select the attribute value you want to change.
Let’s say, we want to use the same click to perform click on Edit, Format, View or Help buttons. So we will need to parameterize the ctrl name.
Step 3: Right click that attribute value and select “Create Variable” option.
Step 4: Give the variable a name, default value and click Enter.
We will now have the new variable added instead of the previous property value:
Click on Validate button to validate the selector, it should turn green:
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. 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.
An RPA Developer with 3+ years in RPA and Intelligent Process Automation (IPA) using Blueprism and UiPath.
Advocate of strong CI-CD deployment and being part of CoE.
Blue Prism, UiPath, Docker, Python, RPA, Outsystems, Power Apps, Azure, Zend Server, Zend Studio, Zend Guard, CMS, Zoomla, WordPress, Webservices, Linux, Windows, Abby Flexi Capture, Networking, PHP, Power Automate