# GetAttribute

> Retrieves an attribute of a specified UI element.

Retrieves an attribute of a specified UI element.

## Definition

**Namespace**: UiPath.MobileAutomation.API.Models

**Assembly**: UiPath.MobileAutomation.API (in UiPath.MobileAutomation.API.dll)

## Overloads

| Overload | Description |
| --- | --- |
| `GetAttribute(IElementDescriptor, string, MobileOptions.GetAttributeOptions)` | Retrieves an attribute of a specified UI element, identified as an `IEelementDescriptor`. |
| `GetAttribute(ObjectRepositoryTarget, string, MobileOptions.GetAttributeOptions)` | Retrieves an attribute of a specified UI element, identified as an `ObjectRepositoryTarget`. |
| `GetAttribute(SelectorTarget, string, MobileOptions.GetAttributeOptions)` | Retrieves an attribute of a specified UI element, identified as a `SelectorTarget`. |

## `GetAttribute(IElementDescriptor, string, MobileOptions.GetAttributeOptions)`

Retrieves an attribute of a specified UI element, identified as an
`IEelementDescriptor`.

```
GetAttribute(
	    IElementDescriptor element,
	    string attributeName,
	    MobileOptions. GetAttributeOptions options = null
)
```

`element` `IElementDescriptor`
:   A UI element from the Object Repository that you access using the
    `ObjectRepository.Descriptors` class.

    Visit [Using objects in coded
    automations](https://docs.uipath.com/studio/standalone/2023.10/user-guide/creating-an-object-repository#using-objects-in-coded-automations) to learn how to use Object Repository elements in
    coded automations.

`attributeName` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The name of the attribute you want to retrieve from the specified UI
    element.

`options` [MobileOptions.GetAttributeOptions](https://docs.uipath.com/activities/other/latest/ui-automation/uipath-mobileautomation-api-models-mobileoptions-getattributeoptions) (Optional)
:   Specifies the `MobileOptions.GetAttributeOptions` for the
    `GetAttribute` action. Default value is null.

## `GetAttribute(ObjectRepositoryTarget, string, MobileOptions.GetAttributeOptions)`

Retrieves an attribute of a specified UI element, identified as an
`ObjectRepositoryTarget`.

```
GetAttribute(
	    ObjectRepositoryTarget objectRepositoryTarget,
	    string attributeName,
	    MobileOptions. GetAttributeOptions options = null
)
```

`objectRepositoryTarget` [ObjectRepositoryTarget](https://docs.uipath.com/activities/other/latest/ui-automation/objectrepositorytarget#objectrepositorytarget)
:   An object of type `ObjectRepositoryTarget`. Can be
    constructed using `FromObjectRepository(String, String, String,
    String)` or `FromObjectRepository(String[] , String,
    String, String)` methods.

`attributeName` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The name of the attribute you want to retrieve from the specified UI
    element.

`options` [MobileOptions.GetAttributeOptions](https://docs.uipath.com/activities/other/latest/ui-automation/uipath-mobileautomation-api-models-mobileoptions-getattributeoptions) (Optional)
:   Specifies the `MobileOptions.GetAttributeOptions` for the
    `GetAttribute` action. Default value is null.

## `GetAttribute(SelectorTarget, string, MobileOptions.GetAttributeOptions)`

Retrieves an attribute of a specified UI element, identified as a
`SelectorTarget`.

```
GetAttribute(
	    SelectorTarget targetSelector,
	    string attributeName,
	    MobileOptions. GetAttributeOptions options = null
)
```

`selectorTarget` [SelectorTarget](https://docs.uipath.com/activities/other/latest/ui-automation/selectortarget#selectortarget)
:   An object of `SelectorTarget` type. Can be constructed using
    `FromSelector(String)` method.

`attributeName` [String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)
:   The name of the attribute you want to retrieve from the specified UI
    element.

`options` [MobileOptions.GetAttributeOptions](https://docs.uipath.com/activities/other/latest/ui-automation/uipath-mobileautomation-api-models-mobileoptions-getattributeoptions) (Optional)
:   Specifies the `MobileOptions.GetAttributeOptions` for the
    `GetAttribute` action. Default value is null.

## Return value

[String](https://learn.microsoft.com/en-us/dotnet/api/system.string?view=net-8.0)

The value of the retrieved attribute.
