grafana/k6 · error
dispatching frame event
Error message
dispatching frame event %q to %q: %w
What it means
Returned by Frame.DispatchEvent when dispatching the event on the first matching element fails. The wrap names the event type and selector; the wrapped error from the action pipeline (attachment wait, evaluation of the dispatch, CDP error) holds the cause.
Solutions
- Ensure the selector matches an attached element
- Use a standard event type string (e.g. 'click', 'keydown')
- Increase the timeout and retry after DOM settles
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:826 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/48122e051b9bed84.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame.go:834
dblclick := func(_ context.Context, eh *ElementHandle, p *Position) (any, error) {
return nil, eh.dblclick(p, opts.ToMouseClickOptions())
}
act := f.newPointerAction(
selector, DOMElementStateAttached, opts.Strict, dblclick, &opts.ElementHandleBasePointerOptions,
)
if _, err := call(f.ctx, act, opts.Timeout); err != nil {
return errorFromDOMError(err)
}
return nil
}
// DispatchEvent dispatches an event for the first element matching the selector.
func (f *Frame) DispatchEvent(selector, typ string, eventInit any, opts *FrameDispatchEventOptions) error {
f.log.Debugf("Frame:DispatchEvent", "fid:%s furl:%q sel:%q typ:%q", f.ID(), f.URL(), selector, typ)
if err := f.dispatchEvent(selector, typ, eventInit, opts); err != nil {
return fmt.Errorf("dispatching frame event %q to %q: %w", typ, selector, err)
}
applySlowMo(f.ctx)
return nil
}
// dispatchEvent is like DispatchEvent but takes parsed options and neither throws
// an error, or applies slow motion.
func (f *Frame) dispatchEvent(selector, typ string, eventInit any, opts *FrameDispatchEventOptions) error {
dispatchEvent := func(apiCtx context.Context, handle *ElementHandle) (any, error) {
return handle.dispatchEvent(apiCtx, typ, eventInit)
}
const (
force = false
noWaitAfter = false
)
act := f.newAction(
selector, DOMElementStateAttached, opts.Strict, dispatchEvent, []string{},View on GitHub (pinned to 3fcf5388d7)