Convert UiPath.Core.UiElement to text

Stored an array of tags (HTML tags) of type UiPath.Core.UiElement. When trying to print the individual items, only “UiPath.Core.UiElement” gets printed although the number of times it gets printed is equal to the number of tags. So obviously the tags seem to be there but not able to access/print them. Is there a way to get the values stored in them? Is there any typeCasting required to get the data?

Thank you!!

You need to be able to read the attributes of respective UiPath.Core.UiElement to get the values.

For your requirement, you may need

  1. Tag/Type - Type of element input,button etc
  2. aaname - Element Name
  3. Value - Input value (for textbox)

If you are looping the array:

You could either use the GetAttribute activity and pass the attribute as string to get the Value.

or

item.Get(“attribute name”)

2 Likes

Thank You…

@vvaidya

Is there any way to arbitrarily list all available attributes of the UiPath.Core.UiElement?

Something like this?

String.Join(“,”,uielement.Attributes.ToList())

4 Likes

I can’t get the aaname out from UiPath.Core.UiElement

Only options are:
image

1 Like

hey @snoopy

you can use Get Attribute activity and pass selector there as per below example.
just go through with it and you will get more understanding.

Regards…!!
Aksh

Is there a way to check for multiple occurrences of an element?
On a form I have there can be multiple warnings and they all have the same selector.
I check for warnings with Element Exists but can only get the first one.

Would be nice to have a “Elements Exists” or “Find elements” activity that returned a collection.

1 Like

Hi @snoopy

If there are multiple elements with similar selector, there should be an id property: idx='1'
You can then reach all your elements by incrementing the value of this property.

Example from Notepad’s list of fonts:
image

1 Like

is there any option other than idx, since in my case all the elements have same idx. Didn’t find any other element that can be iterated.

It is tricky. Could you maybe provide an example screenshot?

Normally each element should always have something unique about it that we should be able to use. When you browse the element tree in UiExplorer, try checking out multiple levels, and not only the last node.