How do I create a dynamic selector on click activity?

Hey everyone so Im using the click activity to select an account name. Due to the account name changing when on a different case number I need to use a dynamic selector or atleast I think I do. I was wondering if anyone could give me the step on to creating a dynamic selector so I could do it on my end.

Thanks everyone!

@seanp92,

Could you please paste your selector here. So that we will check and help you.

<html app='chrome.exe' title='Search: 8663545671889 - Console' />
<webctrl id='ext-comp-1033' tag='IFRAME' />
<webctrl aaname='RPA test outlet 1' parentid='Account_body' tag='A' />

@seanp92,

title=‘Search:*-Console’

You can omit title also here and try this also once.

I did that but my aaname will be differnt on a differnt case number. Account name will not always be RPA test outlet

@seanp92,

Oh ok. Could you please give two to three examples of aaname.

Hi @seanp92

You can include wild cards (* or ?) in between your selector to represent changing values. However if you have a value to replace may be like in a variable, you can include that too… So if you have the account number in a variable, you can include the variable in the selector itself

<html app='chrome.exe' title='Search: * - Console' />
<webctrl aaname='"+VariableThatHoldsAAName+"'  tag='A' />

What would I assign the “VariableThatHoldsAAName” to?

If you know the name that you want to search as the account number, then you can have it stored in a variable and use it like that. However, if you do not know what will the value of aaname be, then I suggest use a * there as well…

image

<html app=‘chrome.exe’ title=‘Search: * - Console’ />
<webctrl aaname=’*’ parentid=‘Account_body’ tag=‘A’ />

“Account name” gets selected when I need the account itself to be selected and it does change when the bot seaches for another number

I recommend replace the name of the account (if you know the name of the account) in a variable into your selector, example:

[your_variable] = “MSIP RPA TEST OUTLET”

Hello Guys

I have a similar requirement but the aaname is a bill number which keeps changing. How do I proceed further?

Similarly,
the title should be changed as (168) varries everytime. Please help

Hello guys, i am facing dynamic selector problem,

the selector is,

this id=‘quick_reply_button_text_1_1’ this will change to quick_reply_button_text_2_1 on next click. how to make this as dynamic.

Use * in place of 2 and 1. Since 2 and 1 are changing everytime, you can use wild card * for zero or more characters.
? wildcard for only one character

You can use the concept of dynamic selector.
The tutorial video is available at academy under developer’s foundation course. The section is Selectors.
Also, you can check below link;

I am also facing same issue in SAP operation, here is my selector for button Step 1,
1720 will vary every time when I will login SAP
btnVARIANT1 number one also varies if I marked as * then it highlight wrong field

<wnd app='saplogon.exe' cls='SAP_FRONTEND_SESSION' title='Foreign Trade: Periodic Declarations' />
<sap id='usr/tabsTAB_1700_1/tabpIMPO/ssubSUB_TAB_1700_1:SAPLV50G:1720/btnVARIANT1' />

2020-11-03 16_52_00-Foreign Trade_ Periodic Declarations

Hi, Can you please help me with setting up the dynamic selector.

I am new to UIPath and working on RPA Challenge exercise in which fields are dynamically changing. So, for that I am making the selector dynamic and also created a data table fields that will be used for making dynamic selector. I used the expression as:

aaname=’"+line.Item(0).ToString+"’ tag=‘LABEL’

But this is not working. When I am clicking on validate, the following message is coming: change variable part of each attribute with *.

Please help.

Hello @SD9190

When you have dynamic selectors with variables similar to what you have, simply clicking on Validate in selector editor or UI Explorer will not validate the selector. The reason is, Studio/ UI Explorer will not know what value that variable hold, unless you run it.

So, the best way to test it is, run the program in debug mode, and see whether it actually do the action it intends to do on the proper element :slight_smile:

As an additional note: when the selector is made dynamic with only wild card characters, then the Validate option will work because you are not using any variables in it.

Hope this helps…