grafana/k6 · error

checking hit target at

Error message

checking hit target at %v: %w

What it means

While translating a click/tap point from frame to page coordinates, the injected hit-target check at the given point failed. The point vector is echoed; usually the point falls outside the frame/viewport or the hit-target verification API rejected it.

Solutions

  1. Scroll the element into view before interacting
  2. Use force: true to bypass hit-target checks when overlays are intentional
  3. Click the element handle instead of raw coordinates
Defensive patterns

Strategy: fallback

When it happens

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

Appendix: source

Thrown at internal/js/modules/k6/browser/common/element_handle.go:96

	width := math.Max(quad[0], math.Max(quad[2], math.Max(quad[4], quad[6]))) - x
	height := math.Max(quad[1], math.Max(quad[3], math.Max(quad[5], quad[7]))) - y

	position, err := h.frame.position()
	if err != nil {
		return nil, fmt.Errorf("getting position of parent frame: %w", err)
	}

	return &Rect{X: x + position.X, Y: y + position.Y, Width: width, Height: height}, nil
}

// translatePointToPage translates the point to the page's coordinates if the
// point is relative to the parent frame.
func (h *ElementHandle) translatePointToPage(apiCtx context.Context, point Position) (Position, error) {
	h.logger.Debugf("ElementHandle:translatePointToPage", "point before translation: %v", point)

	frame, err := h.ownerFrame(apiCtx)
	if err != nil {
		return Position{}, fmt.Errorf("checking hit target at %v: %w", point, err)
	}

	if frame == nil || frame.parentFrame == nil {
		h.logger.Debugf("ElementHandle:translatePointToPage", "no parent frame")
		return point, nil
	}

	el, err := frame.FrameElement()
	if err != nil {
		return Position{}, err
	}

	box, err := el.BoundingBox()
	if err != nil {
		return Position{}, fmt.Errorf("getting bounding box of parent frame: %w", err)
	}

	if box.contains(point) {

View on GitHub (pinned to 3fcf5388d7)