> For the complete documentation index, see [llms.txt](https://docs.simplifyqa.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.simplifyqa.ai/introduction-to-object-repository/capture-objects-for-your-tests.md).

# Capture Objects for your Tests

Capturing objects in SimplifyQA is essential for automating test cases. It allows the system to identify and interact with elements like buttons, text fields, dropdowns, etc., during test execution.

### Methods to Capture Objects in SimplifyQA

1. **Capturing Objects Using the SimplifyQA Recorder**

The SimplifyQA Recorder helps capture UI elements automatically from web or mobile applications.

**Steps to Capture Objects:**

Opening the Recorder

* Click on the Recorder button located at the top-right corner of the SimplifyQA interface.

<figure><img src="/files/PxP2CDJfmTr0nipSCmom" alt=""><figcaption></figcaption></figure>

Entering Mandatory Details

* Fill out the required details:
  * Name: Provide a meaningful name for the recording session.
  * URL: Enter the URL of the web application you want to test.
  * Browser: Select the browser in which you want to record the test.

<figure><img src="/files/ORWZq6L50y43P4nxwhsw" alt=""><figcaption></figcaption></figure>

Starting the Recording

* Click on Start Recording to initiate the session.
* The tool will launch the web application in the selected browser.

Capturing Objects while Navigating the Application

* As you hover over different elements in the application, a blue highlight will appear, indicating the objects being identified by the tool.
* Any action performed on these objects (click, input text, select, etc.) will be recorded back into the tool, including the captured objects.

<figure><img src="/files/QPIW5hJfRVppPTfuQqn7" alt=""><figcaption></figcaption></figure>

Viewing Recorded Steps and Captured Objects

* Navigate back to the SimplifyQA tool to review the recorded steps.
* All recorded actions and captured objects will be displayed in the tool.

Viewing Object Details & Attributes

* Click on any captured object to open its details.

<figure><img src="/files/Wv7f8vbhYCUOIOBhg3lO" alt=""><figcaption></figcaption></figure>

* The tool captures multiple attributes of each object to ensure smooth execution, even if minor changes are made to the application.
* The attributes include:
  * XPath
  * CSS Selector
  * ID, Class, Name, Tag, etc.

<figure><img src="/files/fCFefYTB7rIOZbPTlYJu" alt=""><figcaption></figcaption></figure>

Editing and Managing Objects

* Objects can be edited when viewing their details:
  * Rename objects for better clarity.
  * Add new attributes to improve object recognition.
  * Set a default attribute for execution stability.

<figure><img src="/files/uejAuYAxMIMi9worNgFD" alt=""><figcaption></figcaption></figure>

2. **Manually Adding Objects**

**Method 1:** Adding Objects from a Test Case

You can add objects directly within a test case while defining steps.

**Steps to Add an Object from a Test Case:**

* Open the Test Case where you need to add an object.
* In the Steps section, locate the object field.
* Click on the "+" icon in the object field

<figure><img src="/files/TZPvYzREkhtESA5c5gJt" alt=""><figcaption></figcaption></figure>

* A create object popup will appear
* Fill out the mandatory fields:
  * Name: Provide a unique idntifier for the object.
  * Object Template: Select the type of object (Web, API, Generic, Database, etc.)
  * Technology: Choose the technology (Web, Mobile, Desktop).
  * Xpath: Enter the XPath or other locator details.

<figure><img src="/files/fSFHM7JRknl9S8BrxxUt" alt=""><figcaption></figcaption></figure>

* Click Save to create the object.
* The object will be added to the Object field and can now be used in the test case.

**Method 2:** Adding Objects from the Object Repository

Objects can also be created separately in the Object Repository, making them reusable across multiple test cases.

**Steps to Add an Object from the Object Repository:**

* Navigate to the User Navigation Panel.
* Go to Test Management > Object Repository.

<figure><img src="/files/jVRiCVGAGBS6RRu2IerB" alt=""><figcaption></figcaption></figure>

* Click the "**+ Object**" button.

<figure><img src="/files/JV2UIL0uThQqsfYNscOy" alt=""><figcaption></figcaption></figure>

* The Create Object popup will appear (similar to Method 1).
* Enter the required details:
  * Name
  * Object Template (Web, API, Generic, Database, etc.)
  * Technology (Web, Mobile, Desktop)
  * XPath or other locator information
* Click Save to store the object in the repository.

<figure><img src="/files/mV8rb0W5sbEXUaXYt8X1" alt=""><figcaption></figcaption></figure>

* The newly created object can now be used in any test case when needed.

3. **Using Captured Objects in your Test Case**

After capturing objects, you can reference them in your test steps.

Example: Login Test Case

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><strong>STEP</strong></td><td valign="top"><strong>OBJECT NAME</strong></td><td valign="top"><strong>ACTION</strong></td><td valign="top"><strong>PARAMETER</strong></td></tr><tr><td valign="top">1</td><td valign="top">username_field</td><td valign="top">Enter Text</td><td valign="top">testuser</td></tr><tr><td valign="top">2</td><td valign="top">password_field</td><td valign="top">Enter Text</td><td valign="top">password123</td></tr><tr><td valign="top">3</td><td valign="top">login_button</td><td valign="top">Click</td><td valign="top"></td></tr></tbody></table>

During execution, SimplifyQA will fetch the object from the repository and interact with the UI accordingly.

### Best Practices for Capturing Objects

* Use Unique Identifiers: Prefer stable locators like ID or Name over dynamic XPath.
* Group Related Objects: Organise objects by screens (e.g., LoginPage, DashboardPage).
* Use Descriptive Names: Instead of button1, use submit\_button.
* Verify Objects Before Execution: Ensure objects are captured correctly by testing them before running automation.

### Troubleshooting Object Capture Issues

<details>

<summary>What does the "Object Not Found" error mean?</summary>

This error indicates that the system could not locate the specified object on the screen or within the application.

Common reasons include:

* The **locator is incorrect or outdated**.
* The **object’s properties have changed** due to application updates.
* The object is **dynamic or temporarily invisible** at the time of execution.
* Changes in the **application’s structure** affecting how elements are identified.

To fix this error:

* **Verify that the locator is correctly defined** and accurately points to the intended element.
* **Update the locator** if it no longer matches the current element properties.
* Check for **dynamic content, visibility issues, or UI changes** in the application that might affect object recognition.

</details>

<details>

<summary>How to handle dynamic elements?</summary>

Some elements on a webpage or application may have attributes that change dynamically, such as IDs, class names, or other properties. These elements can be challenging to locate using static locators. To handle such cases, use parameterised XPath expressions or regex-based locators that allow flexibility in identifying elements.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.simplifyqa.ai/introduction-to-object-repository/capture-objects-for-your-tests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
