# Set Element Attribute

This activity sets a given value to a user-specified attribute name in a given XML input. XPath is used to obtain the target element.

### Input

* **Input:** [`String Argumen`](https://docs.visualyze.ai/getting-started/rpa-studio/arguments#string) <mark style="color:red;">`Required`</mark>\
  Set XML as input .
* **Target Element:** [`String Argument`](https://docs.visualyze.ai/getting-started/rpa-studio/arguments#string) <mark style="color:red;">`Required`</mark>\
  Input the XPath for the target element.
* **Attribute Name:** [`String Argument`](https://docs.visualyze.ai/getting-started/rpa-studio/arguments#string) <mark style="color:red;">`Required`</mark>\
  Input the attribute name to set the value.
* **Attribute Value:** [`String Argument`](https://docs.visualyze.ai/getting-started/rpa-studio/arguments#string) <mark style="color:red;">`Required`</mark>\
  Input the attribute value for the specified element.
* **Index:** [`Integer Argument`](https://docs.visualyze.ai/getting-started/rpa-studio/arguments#string)\
  Specifies the index at which the attribute is to be set. Used with Mode **`AtIndex`**.
* **Mode:**\
  Select the method where the element is to be inserted. These are the available options.
  * `First(default)` - The value is set as an attribute value in the first occurrence of the attribute name.
  * `AtIndex` - Sets the value of the specified attribute at the specified index
  * `All` - Sets the value at all the occurrences of the specified attribute.

### Output

* **Result:** [`String Variable`](https://docs.visualyze.ai/getting-started/rpa-studio/variables#string)\
  Stores the XML code after setting attribute value in the specified [String ](https://docs.visualyze.ai/getting-started/rpa-studio/variables#string)variable
