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!
For the purpose of this tutorial, I will make 1 click in the Notepad app.
Feel free to also reference our documentation here.
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
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:
VariablesInSelectors.zip (13.7 KB)