For the complete documentation index, see llms.txt. This page is also available as Markdown.

Selectors

Selectors in the Data Repository are used to locate elements in the application under test.

Selectors allow automated tests to identify UI components such as buttons, input fields, links, tables, and other interactive elements on a web page. By storing selectors in the Data Repository, you can manage them centrally and reuse them across multiple test cases.

This approach makes your tests easier to maintain. If an application’s UI changes, you can update the selector once in the repository instead of editing multiple test cases.

Selectors can be created, edited, and deleted in the Data Repository → Selectors section.


Selector Types

TestFirst supports the following selector types:

  • CSS Selectors – commonly used for locating elements using CSS syntax

  • XPath Selectors – useful for locating elements in complex DOM structures

Both selector types can be used to identify elements during automated test execution.


Add a Selector

To create a new selector:

Step 1 - Select Selectors

Open the Data Repository and select Selectors tab.

Step 2 - Open the Add Item Modal

You can add a selector in two ways:

  • Click the New Item icon in the Data Repository header

  • Right-click the folder where you want to add the selector and select Add Item

The Add Item modal will appear.

Step 3 - Enter Selector Details

Provide the following information:

  • Name – The name used to identify the selector

  • Folder – Folder where the selector will be stored

  • Environment – The environment where the selector will be used

  • Type – Select the selector type (CSS or XPath)

  • Value – Enter the selector expression

Step 4 - Save the Selector

Click SAVE.

The selector is now stored in the Data Repository and can be referenced in test cases.


Edit a Selector

To modify an existing selector:

Right-click the selector, then select Edit. The Edit Item modal will appear.

Update the fields as needed, then click SAVE.


Delete a Selector

Right-click the selector, then select Delete. The Delete Item confirmation modal will appear. Click YES to permanently remove the selector.

Best Practices

To keep selectors reliable and maintainable:

  • Use clear and descriptive selector names

  • Prefer stable element attributes such as IDs or data attributes

  • Avoid selectors that rely on dynamic values

  • Store frequently used selectors in shared folders

  • Update selectors in the repository instead of editing multiple tests

Managing selectors properly helps keep automated tests stable, reusable, and easier to maintain.

Last updated