How-to
Key press (press)
Key press (press)
Presses one key or a chord. Value is a Playwright key string. Target is optional: with a Target the key goes to the element, without a Target it goes to the page.
Step model
action_name | press |
| Group | Input |
| Target | Optional |
| Value | Required (key) |
| expected_value | Unused |
| TEST_ACCOUNT | Allowed |
| Do not confuse with | type, pressSequentially, fill |
Target/Value facts match the source-of-truth catalog and Autotest step.
Prerequisites
- When Target is set, the element must accept the key.
- For a page chord such as Control+Shift+F, leave Target empty.
Steps
- Add a
pressstep. - Set Target when the key must hit an element. Leave Target empty for a page key.
- In Value enter a key:
Enter,Escape,Tab,F5, or a chordControl+Shift+F. - Modifiers are only
Shift,Control,Alt,Meta, andControlOrMeta. Name case matters. - Save.
The step is stored on the autotest. Next - neighbouring steps or autotest run creation.
Examples
Submit with Enter
Fields in the UI:
| Field | Value |
|---|---|
action_name | press |
| Target | kind LABEL, value Password |
| Value | Enter |
| value_source_type | INLINE |
Step JSON fragment (copy-paste):
json
{
"action_name": "press",
"target": {
"kind": "LABEL",
"value": "Password"
},
"value_text": "Enter",
"value_source_type": "INLINE"
}Page chord
Fields in the UI:
| Field | Value |
|---|---|
action_name | press |
| Target | empty |
| Value | Control+Shift+F |
| value_source_type | INLINE |
Step JSON fragment (copy-paste):
json
{
"action_name": "press",
"value_text": "Control+Shift+F",
"value_source_type": "INLINE"
}Common mistakes
- Do not write
Ctrl,CMD,Win,Command, orcontrol. The names areControl,Meta, andControlOrMeta. - A chord ends with a key, not a modifier.
Control+Shiftis rejected. - A lone plus is the string
+. Inside a chord, plus separates parts; the plus key isNumpadAdd, and the equals key isEqual. - Without a Target, the step timeout is not applied to the key press.
Screenshots
Screenshots of the step form for press will be added here in a later pass.
Did this page help?