# Create identifier

This document assumes that you are familiar with the concept of Element Identifiers. If you aren't familiar with it yet, you can find it here.

{% content-ref url="element-identifier" %}
[element-identifier](element-identifier)
{% endcontent-ref %}

### Auto Generated Identifiers

For many elements in your application, Finalrun can automatically create a unique and stable identifier. This makes the test creation process incredibly fast and efficient. When an element is uniquely identifiable, you can interact with it, and Finalrun will record the step instantly. This process is straightforward and forms the basis of most test creation:

**How it works:**

1. In the Finalrun Test creation editor, hover your cursor over the desired element on the device screen.
2. If the element has a stable, unique identifier available, Finalrun will highlight it with a **green overlay** and display its properties, confirming it is "Identifiable Uniquely".
3. Simply click on the element to record the interaction.
4. As shown in the video, once the "Search" icon is clicked, the test step "Tap on id:nav\_tab\_search" is immediately added to the Test Steps panel on the right, and the action is successfully performed.

{% embed url="https://youtu.be/QJepWnzl90M" %}

### Custom Identifiers

While Finalrun's auto-generation is powerful, some elements might require a more specific identifier. This is common with dynamic lists, elements that share properties, or when you want to create a more resilient identifier based on the element's relationship to other elements on the screen.

**Creating a Custom Identifier using Suggestions**

You can create a custom identifier even for elements that Finalrun can already identify. This gives you full control over how an element is located.

**How it works:**

1. Right-click the element on the device screen to open the context menu.
2. Navigate to **Tap on Element > Center position with custom identifier**.
3. The **"Confirm element for the tap action"** window will open.
4. This window presents a list of suggested identifiers on the left and a JSON editor on the right.
5. Select a suggestion. In the video, the user selects a suggestion that uses an index to specify which button with resource ID "navigation\_bar\_item\_damell\_label\_view" to target, as there are multiple elements with the same ID.
6. You can now edit the JSON directly. Change the index from 2 to 3 and then to 1, showing how you can target different elements by modifying the identifier.
7. Use the **Test** button to highlight the targeted element on the screen and ensure your identifier is correct.
8. Click **Confirm** to add the step with your new custom identifier to the test case.

{% embed url="https://youtu.be/KKTXTP8qvqk" %}

**Creating a Custom Identifier for Non-Unique Elements**

Sometimes, an element cannot be uniquely identified by its properties alone. Finalrun highlights these elements with a **red overlay** on hover. In this case, you can create a unique identifier by describing the element's position relative to a nearby, unique element.

**How it works:**

1. Hover over the target element. A red box indicates that it is not unique. In the video, this is the "more options" icon (three dots) on a card.
2. Clicking the element opens the **"Confirm element for the tap action"** window.
3. Since the element is not unique, you need to add more properties. In this case, we will add a relational identifier to pinpoint the correct icon.
4. In the JSON editor, we will add a "rightOf" property to signify that our target element is to the right of a unique anchor element.
5. To define the rightOf element, hover over a nearby element on the device screen within the popup—in this case, the "Picture of the day" text. Click on it and a tooltip appears showing its **Element Properties**.
6. You can copy a property from this unique element, such as its text.
7. Paste this into the "rightOf" block in your identifier: { "rightOf": { "text": "Picture of the day" } }.
8. Click the **Test** button. Finalrun will now find the "Picture of the day" text and then locate the "more options" icon to its right, successfully identifying it.
9. Click **Confirm** to save the step with this new, robust identifier.

{% embed url="https://youtu.be/zqxsb0vDSJw" %}

