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
While `.press()` dispatches native keyboard events, use [`cy.type()`](/api/commands/type) for:
158
+
159
+
-**Text input**: Typing multiple characters or words
160
+
-**Special character sequences**: `{backspace}`, `{selectAll}`, `{moveToEnd}`
161
+
-**Modifier combinations**: `{ctrl}c`, `{shift}b`
162
+
-**Form filling**: When you need to simulate specific timing of typing behavior
163
+
164
+
```javascript
165
+
// Use .press() for single key events
166
+
cy.press(Cypress.Keyboard.Keys.TAB)
167
+
168
+
// Use .type() for text and complex sequences
169
+
cy.get('input').type('Hello{backspace}World')
170
+
```
171
+
155
172
### Strings with multiple characters
156
173
157
174
Strings with multiple characters are not supported. If you need to input longer strings into a text input or similar, use [`cy.type()`](/api/commands/type).
@@ -176,7 +193,9 @@ If your application prevents the default behavior of the `beforeunload` event, t
Copy file name to clipboardExpand all lines: docs/api/commands/type.mdx
+61-12Lines changed: 61 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,6 +75,12 @@ To disable parsing special characters sequences, set the
75
75
|`{selectAll}`| Selects all text by creating a `selection range`|
76
76
|`{upArrow}`| Moves cursor up |
77
77
78
+
:::info
79
+
80
+
**Note**: For navigation keys like `Tab`, `Arrow` keys, and `Enter` in non-form contexts, consider using [`cy.press()`](/api/commands/press) for more accurate native keyboard event simulation.
81
+
82
+
:::
83
+
78
84
Text passed to `.type()` may also include any of these modifier character
0 commit comments