Choose durable selectors
Choose Element Selectors that stay stable as the page design changes.
Last updated
Choose Element Selectors that stay stable as the page design changes.
An Element is the reusable page object your Test Steps use. A Selector is the rule inside that Element that finds it on the page. Durable Selectors keep Flows working when styles and layout change.
To create an Element (from Assets → Elements or + on a Test Step), including Automatic with a Description, see Creating Elements. This guide is about choosing Selectors that last.
The application exposes a dedicated test attribute
You have a stable id, name, or attribute that names the control
The user-visible label is the clearest identity
You need a DOM relationship the other types do not cover
Start with a Test ID when your team can add one. It describes the control for testing, so styling and copy changes are less likely to break the Flow.
Automatic Elements generate a Selector from a Description. That is a fast way to start. When you need a Selector you can edit and harden, switch the Element to Manual and apply the preferences above. See Creating Elements.
Open the Element from Assets → Elements, or edit it from the Test Step that uses it. For the full create flow, see Creating Elements.
Fill Selector, Text, or Test ID for that type. Keep the expression tight to the control you mean to use, not a large layout wrapper.
Turn on Dynamic Selector only when the expression itself must include a Value.
In Touch, Set value, Check text, or another step, choose the Element you saved. One Element can power many steps and Flows.
Name the control, not its colour or position on the day you wrote the test.
Prefer attributes your team owns for testing over auto-generated class names.
When the control lives inside Shadow DOM, use a Manual CSS Selector with a >>> prefix. See Shadow DOM.
When a step fails to find the Element, open the Element and update the Selector before you add extra Wait steps.
Reuse one Element across Flows instead of recreating the same Selector in each Flow.
After an Automatic Description gets you moving, switch to Manual when you are ready to lock in a durable Selector.
Pro tip: If Touch reports the Element as overlapped or not clickable, fix the Selector or the page state first. Touch already waits and scrolls for the Element.
Last updated