Use variable in selector

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 ".

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

@Sarvesh11

And also show me original selector of this.

1

1 Like

@Sarvesh11

Your selector looks ok. Don’t know where is the problem.

I opened that site from my end. Tell me what you are trying to do here. Will check it and update you.

on this form i need to pass values dynamically…for now i m working on “year” field of “born in”
i want to select value dynamically over here…thanks for looking into this
Regards

@Sarvesh11

please check the attached workflow. Here, I cretaed one variable “year” of type string and passed into the selector. open that web page and then run this workflow.

selectYear.xaml (10.9 KB)

1 Like

Your solution is working fine i did the same thing but sometimes it works some time it doesnt it doesnt give any error thoughYearSelect.xaml (9.9 KB)

@Sarvesh11

Could you please try with Attach browser activity once.

Solution works; Just need to SimulateClick for each Click Activity

1 Like

Hi @Daun,

From starting and ending add double quotes (")

Check this new feature for this! How to use variables in selectors in Studio (dynamic selectors) without string manipulation!

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.