# Variable, Uielement

**URL:** <https://forum.uipath.com/t/variable-uielement/275353>\
**Category:** Studio\
**Tags:** studio, uiautomation, activities\
**Created:** [December 8, 2020, 11:58am UTC](https://forum.uipath.com/t/variable-uielement/275353 "2020-12-08T11:58:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiran\_Kumar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kiran_kumar/32/177051_2.png) [@Kiran\_Kumar](https://forum.uipath.com/u/Kiran_Kumar)\
**Post date:** [December 8, 2020, 11:58am UTC](https://forum.uipath.com/t/variable-uielement/275353/1 "2020-12-08T11:58:20Z")

</div>

How can we see the value of variable of type  
Uielement?  
Is it like the selector Inthe form of tags ?

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [December 8, 2020, 12:09pm UTC](https://forum.uipath.com/t/variable-uielement/275353/2 "2020-12-08T12:09:47Z")

</div>

@Kiran_Kumar  
uielementvar.attributes will return a string array with all attribute keys

using this in a for each activity allows us to retrieve all available info on this element by:  
uilelementvar.Get(“attributekeyname”)

Also have a look here on a prepared inspection approach:

> [@\[HowTo\] - easy UiElement Attributes / Selector Info Retrieval # Reply - Get Element Info Activities Introduction](https://forum.uipath.com/t/howto-easy-uielement-attributes-selector-info-retrieval-reply-get-element-info-activities-introduction/237810):
>
> Often the analysis of an UiPath.Core.UiElement and sharing the results is needed very fast, but cannot be done directly. So this task leads to a lot of manual steps and the person executing it maybe has sometimes less practice to do this. We published a custom library on Connect supporting on this: Introduction Also here in the Forum we do often request and share information about UiElement attributes and / or selector details. It is done often by screenshots but also the requests for more…

---

<div class="post-metadata">

**Author:** ![Nithinkrishna](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nithinkrishna/32/561519_2.png) [@Nithinkrishna](https://forum.uipath.com/u/Nithinkrishna)\
**Post date:** [December 8, 2020, 12:18pm UTC](https://forum.uipath.com/t/variable-uielement/275353/3 "2020-12-08T12:18:00Z")

</div>

Hey @Kiran_Kumar,

The UiElement variable is basically an object holding element related properties & metadata.

Try using below code for getting the selector of that element.

`UiElem.Selector.ToString`

Assuming, UiElem is the variable name (you can change to yours)

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![jeevith](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jeevith/32/288449_2.png) [@jeevith](https://forum.uipath.com/u/jeevith)\
**Post date:** [December 8, 2020, 12:50pm UTC](https://forum.uipath.com/t/variable-uielement/275353/4 "2020-12-08T12:50:22Z")

</div>

Hi @Kiran_Kumar,

Both approaches from @ppr and @Nithinkrishna will work. I am here adding to their answers.

UiElement is an interesting argument type in ~~windows~~ UiPath, but beware they are not so easy to debug, especially if you have many matches of similar elements. So parsing and making the workflows using UiElements robust will usually be a demanding excercise. It also depends on the way the interfaced application is designed.

**For argument type UiElement**  
Then you can use the following to get the corresponding keys and values.

```
yourUiElement.GetNodeAttributes.Keys(Index)
yourUiElement.GetNodeAttributes.Keys(Index)

```

Maximum **Index** here will be number of Key value pairs in your UiElement and this can be dynamic. For example, an image identified in an application can have a (x,y) position, which will be captured in a UiElement key value pairs for each x and y.

**For argument type IEnumerable(UiElement)**  
If you have many UiElements which are matched using for example, `FindImageMatches` activity. Then you will first get all the matches in form of an IEnumerable argument type.

To get the key and values from such a variable you can use the following

```
yourIEnumerableUiElement.ElementAt(IEnumerableIndex).GetNodeAttributes.Keys(Index)
yourIEnumerableUiElement.ElementAt(IEnumerableIndex).GetNodeAttributes.Keys(Index)

```

IEnumerableIndex here can start from 0 to a maximum of yourIEnumerableVarible.Count.

Finally, in both of the above, you can use `For Each` activity to loop through the values you are interested in.

UiPath.Core.UiElement != System.Windows.UiElement  
~~Here is the link to the official Documentation of UiElements: [UIElement Class (System.Windows) | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/api/system.windows.uielement?view=netframework-4.7.2)~~

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [December 8, 2020, 1:30pm UTC](https://forum.uipath.com/t/variable-uielement/275353/5 "2020-12-08T13:30:48Z")

</div>

> [@jeevith](#):
>
> Here is the link to the official Documentation of UiElements: [UIElement Class (System.Windows) | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/api/system.windows.uielement?view=netframework-4.7.2)

we should not do a missmatch  
the uielement from e.g. a find element etc. is from namespace UiPath.Core

---

<div class="post-metadata">

**Author:** ![jeevith](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jeevith/32/288449_2.png) [@jeevith](https://forum.uipath.com/u/jeevith)\
**Post date:** [December 8, 2020, 1:36pm UTC](https://forum.uipath.com/t/variable-uielement/275353/6 "2020-12-08T13:36:25Z")

</div>

Agreed.  
I realize they are two different namespaces. Sadly, UiElement description in UiPath is [quite frail.](https://docs.uipath.com/studio/docs/about-ui-elements) I will edit the link in my previous post.
