Get a non unique attribute with 'Get Attribute' (name)

Hi guys!
I have an element with the attributes:

<wnd app='...' ctrlname='....' />
<ctrl name= 'grid' role='table' />
<ctrl name= 'Row 3' role='row' />
<ctrl name = 'username' role='cell' />

As u can see the ‘name’ attribute is not unique, how can I get the value ‘Row 3’?
Thanks! :yum:

Hi,

Could you please try below steps.

→ use ui explorer and remove the unwanted attributes. after remove please highlight and see it is still pointing out the desired ui element.

eg:

→ Now use get attribute activity and use ‘name’ as input to get the Row3 value.

just a thought not sure it works in your scenario.

Regards,
Kirankumar.

1 Like

Thank u, I tried but it’s not working :frowning:
I use find element before and getting the same element, with the same name attributes, so when I’m trying to get attribute activity it returns the first “name”.

Hi,

are you able to share website or page you are referring or is it your internal site. i will try at my end.

Regards,
Kirankumar.

1 Like

Hi @Shoosha ,

Can’t you uncheck the selector and just keep the Row 3 selector and try with attribute name.

1 Like

Yeah i told the same suggestion but @Shoosha told it is not working. any other thoughts on this.

Regards,
Kirankumar.

1 Like

Hi

  1. We can try with FIND CHILDREN ACTIVITY and use find descendants as scope property and get the output variable

  2. Use a For each activity and pass the above output variable as input and change the type argument as UiPath.Core.UiElement in the property panel

  3. inside the loop use GET ATTRIBUTE activity where pass the variable item.ToString to the property Element in the property panel of get attribute activity

  4. now in the get attribute activity we can mention as “name” and get the output with a variable of type string named str_output

For more details on how to use it

Cheers @Shoosha

2 Likes

Two steps:

  1. Get Ancestor:
    You can use get ancestor activity for the element username, it will return a ui element.
  2. Get Attribute:
    Pass the ui element got in previous step to UiElement property in Target section of Get attribute activity, select the attribute as name.

You should be able to get Row3 as output.

Let me know if it works.

1 Like

Hi @Shoosha

Try you can find the value using find children activity

You can watch this video to know how find children activity works

1 Like

Hi!
First of all, tnx. Unfortunately I can not share because of company values :woozy_face:
I really appreciate your help!
I tried in a different way- it was a data table and I extracted the info from it to a DT var, and then got the specific info from it, and it worked!
Tnx again! :slightly_smiling_face:

1 Like

Hi @Shoosha ,

Thanks for sharing the solution. please elaborate your solution so that it would help others who are facing the similar kind of issue. thanks again.

Regards,
Kirankumar.

1 Like

Thanks to everyone for the help!
You have given here some ideas that seem right, I did not have time yet to test them all,
but they opened up for me thinking directions of a solution.
In my case it was a data table that I wanted to get a specific value from a row, luckily this row had a key so I extracted the info from it to a DT var, and then ran a for each row loop, and looked for the specific data from this row and it worked.
Not the ultimate solution for this question but in my case it worked.

1 Like

Thanks @Shoosha

Thank u for the ideas! I’ll try that. @Boopathi.M @Manan_Narang @Palaniyappan