Interpolated selectors like in C#



For very specific/difficult automation some parts of the selector is known at run-time so the selector looks like
"<wnd title='" + someVariable + "'/>"
which is hard to get right and it is not correctly parsed by our tools (selector editor etc)
It would be nice if we can have something like:
"<wnd title='{someVariable}'/>"

In C# it is called interpolated strings; see:

Dynamically generated Selectors
Dynamically generated Selectors

Great idea - we do this all the time.

Also UiExplorer will not validate the selector but if it prompted you for the variable name you could enter it to prove that he selector is valid. :slight_smile:


The same syntax should also be available in VB.NET since version 14:

Perhaps the selector editor fields could be made to accept variable names and generate such a string? It would definitely be a neat improvement to be able to use variables transparently with the validator and especially the highlighter function in UiExplorer.


What do you say @adrian?


I didn’t find this in the forum:

The selectors are currently a XML strings, but they cannot be dynamically generated. The ability to use wildcards is not enough for me. I think it would be very useful to be able to create selectors using variables eg:
Auto generated Selector:
“(webctrl aaname=‘Insert 1 file’ idx=‘1’ parentid=‘app’ tag=‘SPAN’ /)”

With wildcard:
“(webctrl aaname=‘Insert * file’ idx=‘1’ parentid=‘app’ tag=‘SPAN’ /)”

I would like:
“(webctrl aaname=‘Insert “+fileCount.ToString+” file’ idx=‘1’ parentid=‘app’ tag=‘SPAN’ /)”

Please note quotes and replace brackets with more than and less than as required.



Yes, you can use variables instead of wildcards.


I just tried - is there a limit in community edition?
Or alternatively - what am I doing wrong?


There is also this idea in order to simplify the use of variables in selectors:


How do I ignore the error and still run the process?


Hi badita,

Will this be supported in 2018.2? It’ll really be helpful if it works.

<wnd title='{someVariable}'/>



now it works… but with differente format
"<wnd tile='"+someVariable+"'/>"