grafana/k6 · error

double clicking on element: %w

Error message

double clicking on element: %w

What it means

Top-level wrapper for ElementHandle.Dblclick. It runs the same pointer-action pipeline as Click (scroll into view, visible/stable/enabled waits, hit-target check, double click) under opts.Timeout; any failure surfaces as 'double clicking on element: <cause>'.

Source

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

		return nil, fmt.Errorf("element is not an iframe")
	}

	frame, ok := h.frame.manager.getFrameByID(node.FrameID)
	if !ok {
		return nil, fmt.Errorf("frame not found for id %s", node.FrameID)
	}

	return frame, nil
}

// Dblclick scrolls element into view and double clicks on the element.
func (h *ElementHandle) Dblclick(opts *ElementHandleDblclickOptions) error {
	dblclick := func(_ context.Context, handle *ElementHandle, p *Position) (any, error) {
		return nil, handle.dblclick(p, opts.ToMouseClickOptions())
	}
	dblclickAction := h.newPointerAction(dblclick, &opts.ElementHandleBasePointerOptions)
	if _, err := call(h.ctx, dblclickAction, opts.Timeout); err != nil {
		return fmt.Errorf("double clicking on element: %w", err)
	}

	applySlowMo(h.ctx)

	return nil
}

// DispatchEvent dispatches a DOM event to the element.
func (h *ElementHandle) DispatchEvent(typ string, eventInit any) error {
	dispatchEvent := func(apiCtx context.Context, handle *ElementHandle) (any, error) {
		return handle.dispatchEvent(apiCtx, typ, eventInit)
	}
	opts := NewElementHandleBaseOptions(h.DefaultTimeout())
	dispatchEventAction := h.newAction(
		[]string{}, dispatchEvent, opts.Force, withRetry, opts.NoWaitAfter, opts.Timeout,
	)
	if _, err := call(h.ctx, dispatchEventAction, opts.Timeout); err != nil {
		return fmt.Errorf("dispatching element event %q: %w", typ, err)

View on GitHub (pinned to 93accf6570)

Solutions

  1. Increase the timeout option
  2. Use { force: true } when an overlay is known and benign
  3. Dismiss intercepting overlays first
  4. Re-locate the element immediately before dblclick
  5. Use { noWaitAfter: true } if the post-action navigation wait is the blocker

Example fix

// before
await handle.dblclick({ timeout: 2000 }); // double clicking on element: timeout

// after
await page.waitForSelector(sel, { state: 'visible' });
await (await page.$(sel)).dblclick({ timeout: 30000 });
Defensive patterns

Strategy: retry

Validate before calling

const visible = await handle.isVisible();
const enabled = await handle.isEnabled();
if (!visible || !enabled) throw new Error('element not actionable for dblclick');

Try / catch

try {
  await handle.dblclick({ timeout: 30000 });
} catch (e) {
  const msg = String(e);
  if (msg.includes('intercepting')) {
    await (await page.$('.overlay-close')).click();
    await handle.dblclick({ timeout: 30000 });
  } else if (msg.includes('timed out')) {
    await handle.dblclick({ force: true });
  } else { throw e; }
}

Prevention

When it happens

Trigger: handle.dblclick() on an element that never becomes visible/stable/enabled in time, an overlay intercepting the hit target, the element detaching mid-action, or the navigation wait timing out after the double click.

Common situations: Double-clicking rows in grids with loading overlays; animations preventing 'stable'; disabled controls; short timeouts in CI; stale handles after list re-renders.

Related errors


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