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

Selector Types

Choose CSS, XPath, Visible Text, or Test ID to find Elements on the page.

A Selector is the rule inside an Element that finds it on the page.

Use this page when you already know you are creating a Manual Element and need to pick a Type. To create the Element (Automatic or Manual), see Creating Elements. To choose Selectors that stay stable as the page changes, see Choose durable selectors.

Selector type
Best when

Your application exposes dedicated test attributes (preferred for stability)

The page has clear classes, IDs, or attributes

The control lives inside a Shadow DOM tree (CSS with a >>> prefix)

The control is best found by the text a user can see

You need to move through the DOM or match on text relationships

Prefer Test ID when your team can add test attributes to the application. Use Selectors that describe the Element you mean to use, not incidental layout wrappers. When a click or check fails, open the Element and confirm both the Selector type and the selector value still match the page.

Last updated