grafana/k6 · error

translating point to page: %w

Error message

translating point to page: %w

What it means

For elements inside iframes, pointer actions must translate the frame-relative click point into page coordinates (translatePointToPage). This fails when the owner frame cannot be resolved ('checking hit target at ...' wrapper), the frame element cannot be fetched, or the parent frame's bounding box fails ('getting bounding box of parent frame') — typically because a frame in the chain navigated or detached mid-action.

Source

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

		// Get the clickable point
		if p != nil {
			p, err = h.offsetPosition(apiCtx, opts.Position)
			if err != nil {
				return nil, fmt.Errorf("getting element position: %w", err)
			}
		} else {
			p, err = h.clickablePoint()
			if err != nil {
				return nil, fmt.Errorf("pointer action: %w", err)
			}
		}

		// Further translation of the point might be necessary if the point
		// is still relative to the parent frame it is in and not the page.
		*p, err = h.translatePointToPage(apiCtx, *p)
		if err != nil {
			return nil, fmt.Errorf("translating point to page: %w", err)
		}

		// Do a final actionability check to see if element can receive events
		// at mouse position in question
		if !opts.Force {
			if ok, err := h.checkHitTargetAt(apiCtx, *p); !ok {
				return nil, fmt.Errorf("checking hit target: %w", err)
			}
		}
		// Are we only "trialing" the action but not actually performing
		// it (ie. running the actionability checks).
		if opts.Trial {
			return nil, nil //nolint:nilnil
		}

		b := NewBarrier()
		h.frame.manager.addBarrier(b)
		defer h.frame.manager.removeBarrier(b)

View on GitHub (pinned to 93accf6570)

Solutions

  1. Re-acquire the frame chain and element right before acting: const f = page.frame({ url }); const el = f.waitForSelector(...)
  2. Wait for the iframe content to settle (f.waitForLoadState()) before pointer actions
  3. Retry the action once — frame swaps are frequently transient
  4. Avoid actions that intentionally navigate the iframe concurrently with the click
Defensive patterns

Strategy: retry

Validate before calling

const frame = page.frame({ url: /embed/ });
frame.waitForLoadState('load');
const el = frame.waitForSelector('#inner', { state: 'visible' });
el.click();

Try / catch

try {
  el.click();
} catch (e) {
  if (String(e).includes('translating point to page')) {
    // frame chain mutated mid-action: re-acquire frame and element, retry once
    const f = page.frame({ url: /embed/ });
    f.waitForSelector('#inner', { state: 'visible' }).click();
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Clicking inside an iframe while that iframe (or its parent) navigates or is removed; frame tree mutated between the actionability check and translation; cross-origin iframe whose frame element evaluation fails.

Common situations: Ad widgets or embeds (payments, videos, maps) that reload on their own schedule; iframes swapped after login flows; clicking inside iframes on pages that periodically re-render their frame layout.

Related errors


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/d1fe663e297e7c13. Report an issue: GitHub.