You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/cypress-api/element-selector-api.mdx
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ sidebar_position: 105
9
9
10
10
# Cypress.ElementSelector
11
11
12
-
The ElementSelector API lets you define how Cypress selects elements in tools like [Cypress Studio](/app/guides/cypress-studio) and the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground).
12
+
The ElementSelector API lets you define how Cypress selects elements in tools like [Cypress Studio](/app/guides/cypress-studio) and the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground) (which will be replaced by Cypress Studio once it is no longer experimental).
13
13
14
14
By setting your own selector strategy, you can control which attributes Cypress prioritizes (like `data-*`, `id`, or `aria-label`) when generating selectors. This helps you enforce consistency, improve test readability, and make generated tests more resilient to changes in your HTML.
15
15
@@ -33,6 +33,14 @@ An object containing any or all of the following options:
|`selectorPriority`|`Array of strings`| Determines the order of attributes Cypress uses to generate selectors. |
35
35
36
+
:::info
37
+
38
+
##### API Stability
39
+
40
+
The `selectorPriority` API is under active development and may change in future versions as we refine the best way to generate selectors within our products. Stay updated with our [changelog](/app/references/changelog) for any breaking changes.
41
+
42
+
:::
43
+
36
44
Accepted values for `selectorPriority` are:
37
45
38
46
-`attribute:${string}` - for specific attributes like `attribute:aria-label`, `attribute:lang`, etc.
@@ -64,7 +72,7 @@ The [jQuery element](http://api.jquery.com/Types/#jQuery) for which you want to
64
72
65
73
### Set custom selector priority
66
74
67
-
You can customize how Cypress generates selectors by defining a priority order for which attributes to prefer. This affects the selectors you see in tools like [Cypress Studio](/app/guides/cypress-studio) and the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground).
75
+
You can customize how Cypress generates selectors by defining a priority order for which attributes to prefer. This affects the selectors you see in tools like [Cypress Studio](/app/guides/cypress-studio) and the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground) (which will be replaced by Cypress Studio once it is no longer experimental).
68
76
69
77
For example, this config tells Cypress to prefer semantic and accessibility attributes before falling back to styling details like class names.
Copy file name to clipboardExpand all lines: docs/app/core-concepts/open-mode.mdx
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -540,6 +540,13 @@ unexpected behaviors
540
540
541
541
## Selector Playground
542
542
543
+
:::caution
544
+
545
+
##### Deprecation Notice
546
+
547
+
The Selector Playground will be replaced by [Cypress Studio](/app/guides/cypress-studio) once it is no longer experimental. Cypress Studio provides the same functionality for constructing Cypress commands using unique selectors, along with additional recording capabilities.
548
+
:::
549
+
543
550
The Selector Playground is an interactive feature that helps you:
0 commit comments