Add selector attribute from UiExplorer

Hi,

I have tried adding the “text” attribute to a selector. The text attribute and value were found with Ui Explorer. I have tried dragging the text attribute to the selector, adding it manually (adding "<text=‘textvalue’ />), but it doesn’t seem to work.
Is the only way to paste the selector value as string in the selector field of the action?

Thanks!
Ben

1 Like

Hi,
In the activity you are trying to add variables
Please click on the activity and click the selector instead of opening the selector.
Now pass the variable where ever you want and like this “+variable+”, the variable should be of string type or else should be converted to string type using .tostring

let us know if this helps,
Regards,
Pavan H

1 Like

Hi Pavanh,

I have tried reading the attribute, then adding it the way you suggested:
It goes like this:

 "<ctrl text='+"varSelector.ToString"+' />"

However, when I try to run, it throws an error. The attribute “text” only appear in the list of properties when I access it through Ui Explorer, but it seems like I can’t add it to the list of selectors.

The error thrown is “can’t find the UI element corresponding to the selector”.

Any idea why it might not have worked?

Thanks!
Ben

Hi,
you copy the selector from Ui Explorer to your activity and then in the activity instead of opening the selector by clicking the 3 dots, you can click the selector and change it there.

Let us know if this helps,
else please see the screenshot and let us know if this helps,
image
Click the yellow region and give your selector and pass the variable there instead of opening the selector.

Let us know if this helps,
Regards,
Pavan H

hi @Ben_RPA please revise your selector to this:

"<ctrl text='" + varSelector.ToString + "' />"

You want the “+” signs outside of the quotations to ensure it is properly concatenating :wink:

Hope this helps!

1 Like

Hi @efleurent & @pavanh003,

Thank you for your prompt responses. I have written the selector in the selector field, following pavanh’s steps and efleurent’s structure/writing.
However, when I ran the script. It didn’t work. You’ll find attached a screenshot of the attribute I want to add.
Is there any way I can just grab it? The issue for now is not setting the attribute’s to a variable, but simply adding the attribute to the list of selectors. I want to add the text attribute to my selector. Therefore, my selector value was:

"<ctrl text='" + varSelector.ToString + "' />"

Hi,
you can use get attribute activity to get the attribute which you want.

Regards,
Pavan H

The “Get attribute” activity gets the value of the attribute we input.
I was able to get the value of the text attribute with that. How could I add any attribute from the property list into the selector?

Thanks!

Hello Ben,

Following @pavanh003 instructions to enter the selector as you please, you can also use the variable that the Get Attribute activity outputs and add it to your selector by using the same structure I suggested earlier.

Are you able to share your workflow? If not, please try and follow something along the lines of my screenshot. Note: the attributeAcquired string variable is the output of the “Get Attribute” activity.

Hope this helped.

Hi efleurent,

You’ll find attached the workflow. I am not sure I understand why you added the attributeAcquired at the end on the selector expression. Shouldn’t it be within the selector (it should basically be replacing the varSelector variable)?

Thanks!

Test_getAttribute_Click.xaml (8.2 KB)

Hi Ben,

Were you able to get the text attribute added to selector…?I’m also facing the same issue…could you please guide me if you know the way?

I confirm. This is impossible to do. it looks like a bug to me that needs to be fixed ASAP.

1 Like

Hello Ben, I think I solved this a different way …

Click on the [Property Selector or 3 Dots icon] either will work . In the 'Edit Selector" region enter the name of the attribute or element that will receive the value in my case it’s labeled as value so (Value = " Some Value Here ") , within the parenthesis you can RIGHT CLICK and it will allow you to pass in a variable to populate the field Dynamically , not it reads:

value=“{{inputName}}” //Write it just like that where inputName is the variable value

Hello i’m facing the same issue, selector is –
<wnd app=saplologon.exe cls=‘SAP_FRONTEND_SESSION’ title='E1*/>

But Bot is unable to highlight , this only happening in SAP.

Did you find any solution?

Hi @GouthamVijay , I am facing the similar challenge in SAP. Did you find any solution for this selector issue in SAP?

Hi @Ben_RPA, I am facing the similar challenge in SAP. Did you find any solution for this selector issue in SAP ?

as it is an older topic lets set it to current level.

For dynamizing a selector we do use the template syntax:

possible selector attributes we do see on the UiExplorer right side top corner.
Left side bottom we do get listed all available attributes. Not all attributes from there (left bottom) are available to use ist within a selector.

So attributes from right side top only can be used

Hi @ppr, This issue is in regard with adding the attribute “text” from the bottom left.

I have attached the screenshot for your reference.

HI @Suhas_M

Solution: Please upgrade to the latest UiAutomation Package, where we have introduced more parameters for identification

Best regards, Lev

2 Likes

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