> 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). Agents can also search and read this documentation through its [MCP server](https://docs.simplifyqa.ai/~gitbook/mcp).

# 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FCztPoVplVrvR9Rf2078o%2F0.jpg?alt=media&amp;token=e0f7e6e6-6a3b-4b8d-a657-1c07d4cbdb3f" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FQpi8UwII3RnkSBUv8YcX%2F1.jpg?alt=media&amp;token=72f0e9a7-1cbd-4415-99be-6b77552b51ed" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2Fll5btyWHpa40s97gj48f%2F2.jpg?alt=media&amp;token=2ed482fc-bfa8-4f9f-aa7b-b7540fba3c3a" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2Fg3ae0uoZC887CFUrnuo6%2F3.jpg?alt=media&amp;token=1303a0da-daf1-443d-9b7e-d2a2e4f5f4a1" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FZcxhfjLCsuoR8XxHe7Dg%2F4.jpg?alt=media&amp;token=5f4487c2-3b03-4fd1-bf8e-b4057a433e01" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FJ8dd8dVlJILxqsIdG51C%2F5.jpg?alt=media&amp;token=e522d1c6-be69-4951-a320-9605c9a8d802" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FxK7NiQEbXxdlpWYtRYpO%2Fnew%20object.png?alt=media&amp;token=03a891e3-570b-4fb0-8d1b-951c39e63051" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FYGYDZDJ8fKBY06iNiPLb%2F7.jpg?alt=media&amp;token=197631e8-5cdc-4302-87c1-06e9b40f70b4" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FSL6pmNVsif9XAXj2EvH1%2F8.jpg?alt=media&amp;token=714276d0-5307-4faf-adc0-2d5840bf4ba4" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2F8eGus0ot5zg0cjAMEddI%2F9.jpg?alt=media&amp;token=d16fe56d-dc8a-42fc-965c-21cf2fc55104" 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="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2F6zyngShTU0nLKjuE1P9i%2F10.jpg?alt=media&amp;token=293f0159-3be9-4786-80be-5b18f960384a" 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>
