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/commands/press.mdx
+7-30Lines changed: 7 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,6 @@ A `keydown`, `press`, and `keyup` event will be dispatched directly to the brows
16
16
17
17
Unlike `cy.type()`, which is best for typing multiple character keys, `cy.press()` will dispatch real keyboard events rather than simulated ones. This command is especially useful when testing focus management and keyboard navigation patterns which are critical for [accessibility testing](/app/guides/accessibility-testing) and great keyboard UX.
18
18
19
-
:::caution
20
-
21
-
<strong>Supported Browsers:</strong>
22
-
This command is supported in chromium browsers and Firefox versions >= v135. WebKit
23
-
is not supported. This command will fail if executed in a browser that does not support
24
-
it.
25
-
26
-
:::
27
-
28
19
## Syntax
29
20
30
21
```javascript
@@ -88,18 +79,13 @@ The key to press. Values for non single character keys are available on [`Cypres
88
79
|`Cypress.Keyboard.Keys.BACKSPACE`|`"Backspace"`|
89
80
|`Cypress.Keyboard.Keys.DELETE`|`"Delete"`|
90
81
|`Cypress.Keyboard.Keys.INSERT`|`"Insert"`|
91
-
|`Cypress.Keyboard.Keys.F1`|`"F1"`|
92
-
|`Cypress.Keyboard.Keys.F2`|`"F2"`|
93
-
|`Cypress.Keyboard.Keys.F3`|`"F3"`|
94
-
|`Cypress.Keyboard.Keys.F4`|`"F4"`|
95
-
|`Cypress.Keyboard.Keys.F5`|`"F5"`|
96
-
|`Cypress.Keyboard.Keys.F6`|`"F6"`|
97
-
|`Cypress.Keyboard.Keys.F7`|`"F7"`|
98
-
|`Cypress.Keyboard.Keys.F8`|`"F8"`|
99
-
|`Cypress.Keyboard.Keys.F9`|`"F9"`|
100
-
|`Cypress.Keyboard.Keys.F10`|`"F10"`|
101
-
|`Cypress.Keyboard.Keys.F11`|`"F11"`|
102
-
|`Cypress.Keyboard.Keys.F12`|`"F12"`|
82
+
|`Cypress.Keyboard.Keys.SPACE`|`"Space"`|
83
+
84
+
:::info
85
+
86
+
F1-F12 keys are not supported. These keys are used for browser shortcuts, and can prevent the test suite from executing properly after they are pressed.
87
+
88
+
:::
103
89
104
90
<Iconname="angle-right" /> **options _(Object)_**
105
91
@@ -178,15 +164,6 @@ By dispatching native keyboard events to the browser, this command will cause th
178
164
179
165
If your application prevents the default behavior of the `beforeunload` event, this may cause issues when navigating away from the current page.
180
166
181
-
### Firefox F6 key
182
-
183
-
In Firefox, [the F6 key is used to change focus to the next frame](https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly#w_current-page).
184
-
Pressing F6 via `cy.press()` will dispatch the initial `keydown` appropriately, but
185
-
due to the focus change, the `keyup` event will not be dispatched to the iframe containing
186
-
the application under test.
187
-
188
-
To re-focus the iframe after pressing F6, use [`cy.focus()`](/api/commands/focus).
0 commit comments