> For the complete documentation index, see [llms.txt](https://docs.userlane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.userlane.com/assistance/in-app-guidance/creating-selectors/manage-selectors.md).

# Manage selectors

How to refine a selector, write selector rules, and configure automatic content capture.

You can adjust selectors[^1] directly in the Editor[^2]. This article covers three workflows: refining one selector when it stops matching, writing selector rules for all new recordings in an application, and turning on automatic content capture.

All three are scoped per application and apply only to new recordings. Existing content keeps its current selectors unless it is re-recorded.

Admins and moderators can access these features.

## Refine a selector

When a selector stops matching, open the content in the Editor and use the **Refine Selector** flow to inspect and adjust it. The click path varies by content type, but the flow always has the same name.

The **Refine Selector** flow shows the selector, its sub-selectors, and any element text attached to it. From here you can:

* **Edit the selector by hand.** The Editor validates the selector when you edit and save it, so a malformed selector is rejected before it reaches content.
* **Add element text.** This builds a content selector that matches the target by its visible text. It works for targets inside cross-origin iframes (frames served from a different domain). Element text helps when the element has no reliable attributes, or when the same content has to work across environments where element identifiers differ.
* **Copy a selector.** A one-click copy captures the full selector, including sub-selectors, content, and ordering, as structured data.

{% hint style="info" %}
Editing a selector changes only that piece of content. To change how selectors are built for all future recordings, use selector rules instead.
{% endhint %}

## Selector rules

Selector rules tell the Editor which element attributes to prioritize, use when helpful, or ignore when it builds a new selector. Rules are scoped per application, can be narrowed to specific element types, and are evaluated in priority order.

Manage selector rules in **Editor** > **Settings** > **Selector Rules**. Each rule uses one of three types:

<table><thead><tr><th width="133.0711669921875">Rule</th><th>What it does</th></tr></thead><tbody><tr><td><strong>Insist</strong></td><td>Always include this attribute when it is present, even when the attribute sits on a parent element above the target.</td></tr><tr><td><strong>Prefer</strong></td><td>Use this attribute when it helps produce a unique match. It may be left out if the selector is already unique without it.</td></tr><tr><td><strong>Ignore</strong></td><td>Never use this attribute, even when it would otherwise be the only distinguishing feature.</td></tr></tbody></table>

Multiple **Insist** rules on the same element are all kept, not just one.

### When to use rules

Rules are most useful on enterprise applications where the same attribute is reliable on one element type and volatile on another. Common patterns include ignoring a dynamically generated `id` on iframes, insisting on a stable `data-*` attribute across all elements, or preferring `id` only on list elements where it is known to be stable.

## Automatic content selector

An application-level setting makes every new recording capture the element's visible text as an extra matching criterion. It is off by default. Turn it on in **Editor** > **Settings** > **Selector Settings**, next to the selector rules.

When it is on, each newly recorded step stores a content selector built from the target element's visible text. This works for targets inside iframes as well as elements on the main page.

The setting suits single-language applications and applications whose element identifiers differ between environments, for example staging and production. It can break when the interface language changes, because the stored text no longer matches the text on screen. See [Languages](/assistance/content-operations/languages.md) for how interface languages are served.

## Relevant articles

{% content-ref url="/pages/eQPgnZdiJgIJ0ByK3cM1" %}
[Creating selectors](/assistance/in-app-guidance/creating-selectors.md)
{% endcontent-ref %}

{% content-ref url="/pages/1S0Ysrf45iMPMs4rp5yk" %}
[Creating guides](/assistance/in-app-guidance/creating-guides.md)
{% endcontent-ref %}

{% content-ref url="/pages/CIerDK8LXMzMPa8Zey5u" %}
[Languages](/assistance/content-operations/languages.md)
{% endcontent-ref %}

{% content-ref url="/pages/brm1JWKM3yHqhKU1n5G2" %}
[A tour of the Editor](/assistance/a-tour-of-the-editor.md)
{% endcontent-ref %}

## FAQ

<details>

<summary>Do selector rules affect existing content?</summary>

No. Selector rules apply to new recordings only. Existing content keeps its current selectors unless it is re-recorded against the current page.

</details>

<details>

<summary>Can I combine multiple rule types on the same attribute?</summary>

No. Each attribute has one rule type per element scope. Multiple **Insist** rules on different attributes are all kept when they match the same element.

</details>

<details>

<summary>What does the automatic content selector do for iframes?</summary>

It captures the visible text of elements inside iframes the same way it does for elements on the main page. This helps most when an iframe's elements have no reliable attributes.

</details>

<details>

<summary>Who can access selector management features?</summary>

Admins and moderators. Other roles cannot refine selectors, write rules, or turn on the automatic content selector.

</details>

<details>

<summary>Will the automatic content selector break multilingual content?</summary>

It can. The stored text matches against the visible text on screen, so if the interface language changes, the match fails. The setting works best for single-language applications.

</details>

[^1]: A selector is the rule Userlane uses to find an element on the page. If the application changes, the selector may need refining so it still matches.

[^2]: The Editor is the workspace where Userlane content is built, separate from the portal where content is targeted and analytics are viewed.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.userlane.com/assistance/in-app-guidance/creating-selectors/manage-selectors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
