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
Updates for renaming SelectorPlayground to ElementSelector API (#6212)
* Updates for SelectorPlayground to ElementSelector
* add migration section for SelectorPlayground renaming
* remove links to selector-playgroun-api
* lint
description: 'The Element Selector exposes APIs that enable you to change the default selector strategy and override the selectors that are returned per element.'
4
+
sidebar_label: ElementSelector
5
+
sidebar_position: 105
6
+
---
7
+
8
+
<ProductHeadingproduct="app" />
9
+
10
+
# Cypress.ElementSelector
11
+
12
+
The Element Selector API is used to get the selector priority for selecting elements in [Cypress Studio](/app/guides/cypress-studio) and [Selector Playground](/app/core-concepts/open-mode#Selector-Playground).
13
+
14
+
## Syntax
15
+
16
+
```javascript
17
+
Cypress.ElementSelector.defaults(options)
18
+
Cypress.ElementSelector.getSelector($el)
19
+
```
20
+
21
+
### Arguments
22
+
23
+
<Iconname="angle-right" /> **options _(Object)_**
24
+
25
+
An object containing any or all of the following options:
|[`Cypress.arch`](/api/cypress-api/arch)| CPU architecture name of the underlying OS, as returned from Node's `os.arch()`. |
196
-
|[`Cypress.browser`](/api/cypress-api/browser)| Information about the current browser, such as browser family and version. |
197
-
|[`Cypress.Commands`](/api/cypress-api/custom-commands)| Create new custom commands and extend or override existing ones. |
198
-
|[`Cypress.config()`](/api/cypress-api/config)| Get and set Cypress configuration from inside your tests. |
199
-
|[`Cypress.Cookies.debug()`](/api/cypress-api/cookies)| Generate console logs whenever a cookie is modified. |
200
-
|[`Cypress.currentRetry`](/api/cypress-api/currentretry)| A number representing the current test retry count. |
201
-
|[`Cypress.currentTest`](/api/cypress-api/currenttest)| An object with information about the currently executing test. |
202
-
|[`Cypress.log`](/api/cypress-api/cypress-log)| This is the internal API for controlling what gets printed to the Command Log. Useful when writing your own custom commands. |
203
-
|[`Cypress.dom`](/api/cypress-api/dom)| A collection of DOM related helper methods. |
204
-
|[`Cypress.env`](/api/cypress-api/env)| Get environment variables from inside your tests. |
205
-
|[`Cypress.isBrowser()`](/api/cypress-api/isbrowser)| Checks if the current browser matches the given name or filter.|
206
-
|[`Cypress.isCy()`](/api/cypress-api/iscy)| checks if a variable is a valid instance of cy or a cy chainable.|
207
-
|[`Cypress.Keyboard.defaults()`](/api/cypress-api/keyboard-api)| Set default values for how the `.type()` command is executed.|
208
-
|[`Cypress.platform`](/api/cypress-api/platform)| The underlaying OS name, as returned by Node's `os.platform()`.|
209
-
|[`Cypress.require`](/api/cypress-api/require)| Enables utilizing dependencies within the [cy.origin()](/api/commands/origin) callback function.|
210
-
|[`Cypress.Screenshot.defaults()`](/api/cypress-api/screenshot-api)| Set defaults for screenshots captured by the `.screenshot()` command and the automatic screenshots taken during test failures.|
211
-
|[`Cypress.SelectorPlayground`](/api/cypress-api/selector-playground-api)|Configure options used by the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground).|
212
-
|[`Cypress.session`](/api/cypress-api/session)| A collection of helper methods related to the `.session()` command. |
213
-
|[`Cypress.spec`](/api/cypress-api/spec)| An object with information about the currently executing spec file. |
214
-
|[`Cypress.testingType`](/api/cypress-api/testing-type)| The current testing type, eg. `"e2e"` or `"component". |
215
-
|[`Cypress.version`](/api/cypress-api/version)| The current Cypress version. |
|[`Cypress.arch`](/api/cypress-api/arch)| CPU architecture name of the underlying OS, as returned from Node's `os.arch()`.|
196
+
|[`Cypress.browser`](/api/cypress-api/browser)| Information about the current browser, such as browser family and version.|
197
+
|[`Cypress.Commands`](/api/cypress-api/custom-commands)| Create new custom commands and extend or override existing ones.|
198
+
|[`Cypress.config()`](/api/cypress-api/config)| Get and set Cypress configuration from inside your tests.|
199
+
|[`Cypress.Cookies.debug()`](/api/cypress-api/cookies)| Generate console logs whenever a cookie is modified.|
200
+
|[`Cypress.currentRetry`](/api/cypress-api/currentretry)| A number representing the current test retry count.|
201
+
|[`Cypress.currentTest`](/api/cypress-api/currenttest)| An object with information about the currently executing test.|
202
+
|[`Cypress.log`](/api/cypress-api/cypress-log)| This is the internal API for controlling what gets printed to the Command Log. Useful when writing your own custom commands.|
203
+
|[`Cypress.dom`](/api/cypress-api/dom)| A collection of DOM related helper methods.|
204
+
|[`Cypress.ElementSelector`](/api/cypress-api/element-selector-api)| Configure selector priority used by [Cypress Studio](/app/guides/cypress-studio) and [Selector Playground](/app/core-concepts/open-mode#Selector-Playground).|
205
+
|[`Cypress.env`](/api/cypress-api/env)| Get environment variables from inside your tests. |
206
+
|[`Cypress.isBrowser()`](/api/cypress-api/isbrowser)| Checks if the current browser matches the given name or filter.|
207
+
|[`Cypress.isCy()`](/api/cypress-api/iscy)| checks if a variable is a valid instance of cy or a cy chainable. |
208
+
|[`Cypress.Keyboard.defaults()`](/api/cypress-api/keyboard-api)| Set default values for how the `.type()` command is executed.|
209
+
|[`Cypress.platform`](/api/cypress-api/platform)| The underlaying OS name, as returned by Node's `os.platform()`. |
210
+
|[`Cypress.require`](/api/cypress-api/require)| Enables utilizing dependencies within the [cy.origin()](/api/commands/origin) callback function. |
211
+
|[`Cypress.Screenshot.defaults()`](/api/cypress-api/screenshot-api)|Set defaults for screenshots captured by the `.screenshot()` command and the automatic screenshots taken during test failures. |
212
+
|[`Cypress.session`](/api/cypress-api/session)| A collection of helper methods related to the `.session()` command.|
213
+
|[`Cypress.spec`](/api/cypress-api/spec)| An object with information about the currently executing spec file.|
214
+
|[`Cypress.testingType`](/api/cypress-api/testing-type)| The current testing type, eg. `"e2e"` or `"component".|
215
+
|[`Cypress.version`](/api/cypress-api/version)| The current Cypress version.|
Copy file name to clipboardExpand all lines: docs/app/guides/cypress-studio.mdx
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,6 @@ e2eSpecific: true
19
19
20
20
:::
21
21
22
-
23
22
## Overview
24
23
25
24
Cypress Studio makes test creation faster and easier. With Studio, you can record user interactions in the browser and instantly generate Cypress test code. Add assertions with a rightclick and fine-tune your tests inline.
@@ -84,9 +83,16 @@ You can also extend and update existing tests using Cypress Studio.
84
83
5. Right-click to add assertions
85
84
6. Click **Save** to save the changes to your spec file
0 commit comments