Trying to get the idx value

Hey guys,
I’m trying to identify the latest message received in a chat, the only unique this i got is the idx but i can’t seem to get the value. I tried the Get Attribute but it returns an empty string, or a different value if I try with the uipath_custom_id. Is there a way to get it? Or is there a better way to identify the latest message? I tried the anchor but I’m too newbie to get it to work

Thank you!

Can you be more specific ?
give us a link to the chat or what you need , we need to try in order to help you .

Thanks in adv acne,

Hey, I can’t send a link, but this is what it looks like

And this is what I got to work with

Nothing specific really, and the idx in this case is 19 and uipath_custom_id is 58

Hi @Hovmark,

You should be able to type an idx element straight into your selector. Try typing idx='1' in your selector at the end and see what it highlights

Hi :slight_smile:
I can see the idx element in the selector editor and get it to highlight it, but i cant get it through get attribute activity or find element

Hi @Hovmark,

You could try using a loop to check all of the messages in the conversation thread. It is not the most efficient way, or elegant, but you could have a While Loop with a counter used in the idx section of a selector, that starts at whatever number you want, inside a Try Catch Then cycle through the messages until there is an error with finding an element. Then in the Catch part of your Try Catch you could add an assign to remove 1 from the counter, then use a Get Text to get the message.

I will attempt to make a rough example workflow so you can visualise it.

1 Like

Oh, thats a great idea! (been trying to find a solution for a while haha) Thanks!!!

1 Like

It is hard for us to tell how volatile the idx is as a selector. Sometimes you can utilize idx because the same value corresponds to the same location/item, but other times it will randomly change.

Similar to what @william.coulson mentioned, you could use a ‘find children’ activity on the parent element. Then use a ‘for each’ activity to loop through each element and pull out the text attribute. This may work all on it’s own, but sometimes there are hidden elements with blank text attributes, or other garbage data thrown in. If that’s the case, then you can add everything from the for each activity into a list, remove empty, blank, and null strings, remove duplicates, then take the last item in the list.

Let me know if you need help with any of the above and I can try and give concrete examples as I’ve done something similar a few times in the past

1 Like

Hey @Hovmark,

Try using this workflow, see if that works. I use something similar for processes I’ve made before.

Main.xaml (11.2 KB)


Thanks a lot guys! LIFESAVERS!! @william.coulson @Dave

1 Like

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