grafana/k6 · error
pressing on element
Error message
pressing %q on element: %w
What it means
Returned by ElementHandle.Press after the internal key-press action (scroll into view, actionability checks, key dispatch via newAction with retry) fails within the configured timeout. The wrapped error carries the real cause: element not visible/enable/editable, hit-target interception, timeout, or a detached element.
Solutions
- Increase the timeout option for press()
- Wait for the element to be visible and stable before pressing (waitForSelector)
- Use force:true to bypass actionability checks if overlays/animations intercept the hit target
- Ensure the element is not disabled or covered by another element
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/element_handle.go:1179 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18).
Data as JSON: /api/errors/75546185e9bef14f.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/element_handle.go:1179
frame, ok := h.frame.manager.getFrameByID(node.FrameID)
if !ok {
return nil, fmt.Errorf("no frame found for id %s", node.FrameID)
}
return frame, nil
}
// Press scrolls element into view and presses the given keys.
func (h *ElementHandle) Press(key string, opts *ElementHandlePressOptions) error {
press := func(apiCtx context.Context, handle *ElementHandle) (any, error) {
return nil, handle.press(apiCtx, key, KeyboardOptions{})
}
pressAction := h.newAction(
[]string{}, press, false, withRetry, opts.NoWaitAfter, opts.Timeout,
)
if _, err := call(h.ctx, pressAction, opts.Timeout); err != nil {
return fmt.Errorf("pressing %q on element: %w", key, err)
}
applySlowMo(h.ctx)
return nil
}
// Query runs "element.querySelector" within the page. If no element matches the selector,
// the return value resolves to "null".
func (h *ElementHandle) Query(selector string, strict bool) (_ *ElementHandle, rerr error) {
parsedSelector, err := NewSelector(selector)
if err != nil {
return nil, fmt.Errorf("parsing selector %q: %w", selector, err)
}
// Check for frame navigation in the selector
frameNavIndex := h.findFrameNavigationIndex(parsedSelector)
if frameNavIndex != -1 {View on GitHub (pinned to 3fcf5388d7)