How to pass variables in selectors

selector
studio
variable

#23

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


#24

please see my solution here.


#25

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


#27
<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.


#28

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.

Regards,


#29

Hi,
I have applied same logic still iam getting error


#32

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


#33

Still problem isn’t resolved @Lucas.Pimenta


#34

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.


#35

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


#36

Hi @Athrix05,

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

For example

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

Output will come as

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

Regards,
Arivu


#38

Wow, thanks for the lovely explanation thala!

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


#39

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 ;


#40