grafana/k6 · error

hovering

Error message

hovering %q: %w

What it means

Returned by Frame.Hover after the internal hover pipeline (resolve selector, actionability checks, move mouse) fails. Wrap-only: the underlying pointer-action error (not visible/stable, intercepted hit target, timeout) carries the real cause.

Solutions

  1. Wait for the element to be visible and stable
  2. Increase the timeout
  3. Use force:true to bypass actionability checks
  4. Ensure nothing covers the element
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:1265 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/bf7a7482428f235f. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame.go:1273

		return nil, fmt.Errorf("navigating frame to %q: %w", url, err)
	}
	applySlowMo(f.ctx)

	// Since the response will be in an interface, it will never be nil,
	// so we need to return nil explicitly.
	if resp == nil {
		return nil, nil //nolint:nilnil
	}

	return resp, nil
}

// Hover moves the pointer over the first element that matches the selector.
func (f *Frame) Hover(selector string, popts *FrameHoverOptions) error {
	f.log.Debugf("Frame:Hover", "fid:%s furl:%q sel:%q", f.ID(), f.URL(), selector)

	if err := f.hover(selector, popts); err != nil {
		return fmt.Errorf("hovering %q: %w", selector, err)
	}

	applySlowMo(f.ctx)

	return nil
}

func (f *Frame) hover(selector string, opts *FrameHoverOptions) error {
	hover := func(apiCtx context.Context, handle *ElementHandle, p *Position) (any, error) {
		return nil, handle.hover(apiCtx, p)
	}
	act := f.newPointerAction(
		selector, DOMElementStateAttached, opts.Strict, hover, &opts.ElementHandleBasePointerOptions,
	)
	if _, err := call(f.ctx, act, opts.Timeout); err != nil {
		return errorFromDOMError(err)
	}

View on GitHub (pinned to 3fcf5388d7)