{
  "doc": {
    "id": "ui-coverage/core-concepts/element-identification",
    "title": "Uniquely identify test elements | Cypress UI Coverage",
    "description": "Elements are uniquely identified across views and snapshots by their HTML attributes, location, and other signals in the DOM.",
    "section": "ui-coverage",
    "source_path": "/llm/markdown/ui-coverage/core-concepts/element-identification.md",
    "version": "48b03b5502f7aea1d0454750cce208f775403542",
    "updated_at": "2026-05-20T19:00:20.270Z",
    "headings": [
      {
        "id": "ui-coverage/core-concepts/element-identification#element-identification",
        "text": "Element Identification",
        "level": 1
      },
      {
        "id": "ui-coverage/core-concepts/element-identification#significant-attributes-for-identification",
        "text": "Significant attributes for identification",
        "level": 2
      },
      {
        "id": "ui-coverage/core-concepts/element-identification#configuring-element-identification",
        "text": "Configuring element identification",
        "level": 2
      },
      {
        "id": "ui-coverage/core-concepts/element-identification#attribute-filters",
        "text": "Attribute filters",
        "level": 3
      },
      {
        "id": "ui-coverage/core-concepts/element-identification#significant-attributes",
        "text": "Significant attributes",
        "level": 3
      }
    ]
  },
  "content": {
    "type": "root",
    "children": [
      {
        "type": "heading",
        "depth": 1,
        "children": [
          {
            "type": "text",
            "value": "Element Identification"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "UI Coverage uniquely identifies elements across views and snapshots using a combination of HTML attributes, location, and other signals in the DOM. Stable and unique identifiers are crucial for accurately tracking and de-duplicating elements throughout the various snapshots captured in your tests."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Significant attributes for identification"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Certain attributes are prioritized by UI Coverage for element identification and grouping. These include:"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`data-cy`"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`data-test`"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`data-testid`"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`data-test-id`"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`data-qa`"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`row-id`"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`id`"
                  }
                ]
              }
            ]
          },
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "text",
                    "value": "`name`"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "By using these attributes consistently in your application, you can improve the accuracy of UI Coverage tracking."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Configuring element identification"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Attribute filters"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Exclude irrelevant or dynamically generated attributes to reduce noise in UI Coverage reports. For example:"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "{  \"uiCoverage\": {    \"attributeFilters\": [      {        \"attribute\": \"id\",        \"value\": \":r.*:\",        \"include\": false      }    ]  }}"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Learn more about attribute filtering in the "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/ui-coverage/configuration/attributefilters.md",
            "children": [
              {
                "type": "text",
                "value": "Attribute Filters"
              }
            ]
          },
          {
            "type": "text",
            "value": " guide."
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Significant attributes"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Define custom significant attributes to prioritize specific selectors that align with your application’s structure. For example:"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "{  \"uiCoverage\": {    \"significantAttributes\": [\"data-custom-id\"]  }}"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Refer to the "
          },
          {
            "type": "link",
            "title": null,
            "url": "/llm/markdown/ui-coverage/configuration/significantattributes.md",
            "children": [
              {
                "type": "text",
                "value": "Significant Attributes"
              }
            ]
          },
          {
            "type": "text",
            "value": " guide for detailed instructions."
          }
        ]
      }
    ]
  },
  "token_estimate": 243
}