How to pass variables in selectors

Hi, Lucas.

I apply the same logic of your example to my case and I get this error

My selector is this

“<webctrl tableCol=‘8’ tableRow=” & pRowCounter.ToString & “tag=‘INPUT’ />”

If someone can help, please.


Hi @aedsferrao,

use this one
"<webctrl tableCol='8' tableRow='"+pRowCounter.ToString+"' tag='INPUT' />"


1 Like


Thanks I forgot to put apostrophes in tableRow.

Works fine now :smiley:

<webctrl aaname=’"+day.ToString()+"’ parentid=‘drawerMiniMonthNavigator’ tag=’
I already used ’ “+day.ToString” ’ but it just didn’t work out. I use google calender so i don’t know this fail just appear on gg calender or not.


1 Like

hi this video help you to understand dynamic selectors

Same, I tried above all methods but still it is going to error.

1 Like

please see my solution here.


I was also getting an error when I tried editing the selector, this post did help me solve it, however when I tried to edit the selector in my Robot I was still getting the selector error, I then noticed the “Selector(String)” title of the Selector box, the trick here is to delete the contents of the selector, come out of the selector box by clicking OK and then going back and entering the selector as a variable or selector embedded in double quotes

<html app='chrome.exe' title='Commodities Futures - Yahoo Finance' />
<webctrl parentid='yfin-list' tag='TABLE' />
<webctrl parentid='yfin-list' tag='TR' aaname='*&quot; + comm.ToString + &quot;*' />
<webctrl tag='TD' colname='Last Price' />

Above code is not working for me,
Note: comm - string type.

You have to pass like:

<html app='chrome.exe' title='Commodities Futures - Yahoo Finance' />
<webctrl parentid='yfin-list' tag='TABLE' />
<webctrl parentid='yfin-list' tag='TR' aaname=' " & + comm.ToString + & " ' />
<webctrl tag='TD' colname='Last Price' />

But you need to pass through a string variable. Not directly on the selector.


I have applied same logic still iam getting error

Hi ,
Iam facing same problem, have you got solution…

Still problem isn’t resolved @Lucas.Pimenta

Follow the below steps:

  1. Make dynamic selector as usual.
  2. Directly paste the selector with “” into the Property–>Target–> Selector but don’t open it from the …
    Find attached screenshot.


Hi Arivu, can you please explain what the + sign on either side of RowCounter.ToString help to achieve?

Hi @Athrix05,

RowCounter is an variable for appending to selector dynamically adding into the selector using the + icon to appending the value.

For example

Then the
"<webctrl tableCol='1' tableRow='"+RowCounter.ToString+"' tag='INPUT' />"

Output will come as

"<webctrl tableCol='1' tableRow='8' tag='INPUT' />"



Wow, thanks for the lovely explanation thala!

BTW, did you mean the output will be :
"<webctrl tableCol='1' tableRow='9' tag='INPUT' />"

Not sure if it’s been mentioned, but remember to write directly in the Selector field.
If you first press “…” to open the Expression Editor, then double quotes " will be saved as rubbish like this: & q u o t ;


Hi everyone,

You can now define your variables for selectors directly in Studio.

Please check our official documentation here:

As well as this short tutorial on our Forum:

I took the liberty to change the solution flag to this post to let our users know about this feature :slight_smile:
Old solution post is this one.