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

thanks @loginerror it’s nice to hear this kind of improvements that make developers life easier :slight_smile:

This has changed my life. You are deeply appreciated @loginerror

1 Like

It will reduce developer mistake during the implementation. :wink:

1 Like

Is there a way to use variables in the selector for us using version 2018.4.3? I wish I had 2019 to use, but as I work for the gov, we are waiting for approval to use 2019 and that could take some time still.

Hi @scott.coil

The old method is to edit the text string of the selector as visible in the Properties panel of the activity that uses it.

If you use the selector editor to do that, it will mess up the string, but if you edit it in the Properties panel, you will be able to concatenate the string like so:
"<selector value=" + yourVariable + ">"

3 Likes

that one worked,

1 Like

@loginerror @Corneliu_Niculite
Should this feature be in Studio 2019.10 Enterprise?
image

I tried right clicking in the Selector Editor, but no context menu showed. So I tried manually typing the variable in and it didn’t work. It’s a Check activity in this example.
image

Thanks.

Clayton.

Yes.

Could you try first selecting the value and then right clicking that selection? It should work.
image

I think it is also dependent on the activity packages, so you should have the System and UIAutomation updated (but I’m not 100% sure here).

1 Like

Ah yes. It needs the Activity package updated for System and UiAutomation.

It works fine now, I can manually type the brackets or use the context menu as desired.

Thanks.

2 Likes

What UIAutomation package do you have? The feature is actually brought by the package.

1 Like

I was on a 2018.4.3 version, but the feature was working after I updated to latest, which was 2019.10 or 11 of the activity package.

1 Like

Hey, I tried this method but I’m unable to perform the right click. When I right click on the selectors to edit it display nothing.

@absam What version of Studio are you using?

2020.2.0. beta, i had earlier used the 2019.4 version also but it had the same problem

Hi @absam

Could you update your system and uiautomation activity packages?

Hi.
Is it possible setting another variable at ‘set value’, not default value?
For example, I want to click the menuOption that is changing for each row.

Hi @jhj3627

Can you explain further what it is you’re trying to do. Are you saying that there is a selector that is changing each time you loop through a for each? If so, I would assign that to a variable and then assign that to the dynamic selector

Oh, I solve that.
This post is wonderful!

2 Likes

Can you create a combination of variable and wild card? Eg ‘{{variable}} *’.

Hi @loginerror
Thank you for sharing this feature which might be the solution for me, but got problem to use as following:

While trying to search for the FB page of my restaurant list (read range from Gsheets),
After clicking search icon and type into the name of restaurant, FB will show a list of search result, but no matter I use Hover Text or Click with dynamic selectors, created valuables for “restaurant” and “restaurant4parentid” with Assigned both valuables to row(5).ToString, it just can NOT be validated, is this the right way to use dynamic selectors?