Use variable in selector

Hi I wonder how you guys can use variable in selector.
I been searching how to do it but I still can’t able to do it. Please help.

For example I have variable is needed to type in search.
It will give me 2-3 options to choose. However I want to choose excactly options got the same name as variable.

Follow is 3 options that I can extracted from screen by UI explorer.

<html app='chrome.exe' title='Client Cases - Sys' />
<webctrl parentid='ui-id-7' tag='STRONG' aaname='Diploma of Hospitality Management' />

<html app='chrome.exe' title='Client Cases* - Sys'/>
<webctrl tag='STRONG' aaname='Diploma of Hospitlity' />

<html app='chrome.exe' title='Client Cases - Sys' />
<webctrl tag='STRONG' aaname='Advanced Diploma of Hospitality Management' />

Either by record or by choose click in activities. I can make Uipath to select 3 options about.
Because I want to use variable name Course to put into selection.

I change the code

<html app='chrome.exe' title='Client Cases* - Sys' />
<webctrl tag='STRONG' aaname=' "+Course+" ' />

to put into selection but it seem give me some errors or doesn’t work some how.

  1. The code <webctrl tag='STRONG' aaname=' "+Course+" ' />
    change to <webctrl tag='STRONG' aaname=' qoute&Course&qoute ' />

2.If I insert Click in activities into the sequense. then paste the code into selector.
it give me error: Complier errors encountered processing expression.

Thank you very much. I appreciate your reply.

Hung

Hi @hungdo,

1.Open the selector from the activity.
2.delete the selector and click ok
3.now again open and paste your selector with double quotes.

Regards,
Arivu

1 Like

Hi arivu

  1. I tried insert click activity
    then choose selector
    and then paste the code.

<html app='chrome.exe' title='Client Cases* - Sys' />
<webctrl tag='STRONG' aaname=' "+Course+" ' />

it shows me complier error.
then I deleted it and paste it again. the errors still there.

  1. I choose click activity and then choose select on screenshot.
    and I can’t delete the selector.

Please advice, Many thanks
Hung

Hi @hungdo,

use this one
<html app='chrome.exe' title='Client Cases* - Sys' /> <webctrl tag='STRONG' aaname='"+Course.ToString()+"' />

Regards
Arivu

Hi arivu
I still got the same errors
as you can see in the pic

Regards
Hung

Hi @hungdo,

I told to use double quotes from starting and ending to make it as string.

So from starting put double quotes" and make it as single line and end use one more double quotes".

"<html app='chrome.exe' title='Client Cases* - Sys' /> <webctrl tag='STRONG' aaname='"+Course.ToString()+"' />"

Regards,
Arivu

2 Likes

Hi
It works.
Many thanks
Hung

Hi Arivu
I wonder if I can use wildcard in this code?
as I wanted to put aaname='"+Course.ToString()*+"' />
but I don’t know how to change the about code.

Thanks
Hung

Hi @hungdo,

Try like this

aaname='"+Course.ToString()+"*' />

Regards,
Arivu

Hi Arivu
The second one is good.
Thank you so much
Hung

Can you please help with this?

it ends up like this -

'&quot;+dayValue.ToString()+&quot;*'

Hi @heretolearn

If you paste/edit your selector directly into this window it will be fine afterwards:
image

For now you cannot add variables via Selector Editor window, because the quotes will turn into this awkward &quot;.

Our team is aware of this issue and bigger improvements in this area are planned for the future :slight_smile:

3 Likes

Help much appreciated.

1 Like

Hi @loginerror

I need to type into a SAP field.

The original selector for field is below:
" <wnd app=‘saplogon.exe’ cls=‘SAP_FRONTEND_SESSION’ title=‘Create Purchase Order’ />
<sap id=‘usr/subSUB0:SAPLMEGUI:0013/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1211/tblSAPLMEGUITC_1211/ctxtMEPO1211-EMATN[4,0]’ />"

I need to make the location of element dynamic by passing variable in place of [column,row]

The selector I am using is:
" <wnd app=‘saplogon.exe’ cls=‘SAP_FRONTEND_SESSION’ title=‘Create Purchase Order’ />
<sap id=‘usr/subSUB0:SAPLMEGUI:0013/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1211/tblSAPLMEGUITC_1211/ctxtMEPO1211-EMATN[4,"+rowIndex+"]’ />"

still I am getting error as below

Compiler error(s) encountered processing expression “” <wnd app=‘saplogon.exe’ cls=‘SAP_FRONTEND_SESSION’ title=‘Create Purchase Order’ />
<sap id=‘usr/subSUB0:SAPLMEGUI:0013/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1211/tblSAPLMEGUITC_1211/ctxtMEPO1211-EMATN[4,"+rowIndex+"]’ />"".
String constants must end with double quote.

I would be grateful if you can resolve it asap.

Hi @shubhmjain2112

Try to paste this into the selector field directly:

"<wnd app='saplogon.exe' cls='SAP_FRONTEND_SESSION' title='Create Purchase Order' /><sap id='usr/subSUB0:SAPLMEGUI:0013/subSUB2:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1211/tblSAPLMEGUITC_1211/ctxtMEPO1211-EMATN[4," + rowIndex + "]' />"
2 Likes

Hi @loginerror

Thanks a lot for your help, but it was not working in one activity but was working in another, so i created a new one and it was working fine afterwards.

Regards,
Shubham

Hi @loginerror,

I am having a different issue while connecting my robot to orchestrator on my workplace’s closed network.
Please let me know if you can help me on it. I’ll share the issuein detail afterwards.

Have a Good Day.

Regards,
Shubham

Hi i m trying to do the same thing this is my edited selector “”

But its giving me an error saying: Click ‘MD-OPTION select_optio…’: The selector is not valid

Can u pls help

@Sarvesh11

Could you please take screenshot of your selector and paste it here.

1 Like