grafana/k6 · error
pressing key
Error message
pressing key: %w
What it means
Wrap of Keyboard.comboPress in the public Keyboard.Press: a press is implemented as successive key-down and key-up dispatches (with an optional delay), and this wrap reports that the sequence failed — one of the keys in the combo string is invalid for the layout, the optional delay wait was interrupted by context cancellation, or a CDP key-event dispatch failed on a dead session.
Solutions
- Verify every key in the combo (e.g., 'Control+Shift+P') is a valid layout key
- Keep the page open for the duration of the press including its delay option
- Replace custom down/up sequences with a single press() call
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/keyboard.go:74 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/68af91dbc4f25a09.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/keyboard.go:74
return fmt.Errorf("sending key down: %w", err)
}
return nil
}
// Up sends a key up message to a session target.
func (k *Keyboard) Up(key string) error {
if err := k.up(key); err != nil {
return fmt.Errorf("sending key up: %w", err)
}
return nil
}
// Press sends a key press message to a session target.
// It delays the action if `Delay` option is specified.
// A press message consists of successive key down and up messages.
func (k *Keyboard) Press(key string, kbdOpts KeyboardOptions) error {
if err := k.comboPress(key, kbdOpts); err != nil {
return fmt.Errorf("pressing key: %w", err)
}
return nil
}
// InsertText inserts a text without dispatching key events.
func (k *Keyboard) InsertText(text string) error {
if err := k.insertText(text); err != nil {
return fmt.Errorf("inserting text: %w", err)
}
return nil
}
// Type sends a press message to a session target for each character in text.
// It delays the action if `Delay` option is specified.
//
// It sends an insertText message if a character is not among
// valid characters in the keyboard's layout.View on GitHub (pinned to 01ffac6f24)