grafana/k6 · error

no frame found for id

Error message

no frame found for id %s

What it means

Returned by ElementHandle.OwnerFrame when the node's FrameID resolves successfully from CDP, but the frame manager has no registered Frame with that ID. This means the browser reported a frame the k6 frame manager does not track, typically because the frame was detached or attached without a corresponding CDP event, or the frame tree is not yet synchronized.

Solutions

  1. Retry after a short wait so the frame manager can process pending frameAttached events
  2. Ensure the frame containing the element is still attached and was not removed from the DOM
  3. Check for races between iframe insertion/removal and the operation; serialize them with waits
Defensive patterns

Strategy: retry

When it happens

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

Appendix: source

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

		}
	}()

	if documentHandle.remoteObject.ObjectID == "" {
		return nil, err
	}

	var node *cdp.Node
	action := dom.DescribeNode().WithObjectID(documentHandle.remoteObject.ObjectID)
	if node, err = action.Do(cdp.WithExecutor(h.ctx, h.session)); err != nil {
		return nil, fmt.Errorf("getting node in frame: %w", err)
	}
	if node == nil || node.FrameID == "" {
		return nil, fmt.Errorf("no frame found for node: %w", err)
	}

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

	return frame, nil
}

// Press scrolls element into view and presses the given keys.
func (h *ElementHandle) Press(key string, opts *ElementHandlePressOptions) error {
	press := func(apiCtx context.Context, handle *ElementHandle) (any, error) {
		return nil, handle.press(apiCtx, key, KeyboardOptions{})
	}
	pressAction := h.newAction(
		[]string{}, press, false, withRetry, opts.NoWaitAfter, opts.Timeout,
	)
	if _, err := call(h.ctx, pressAction, opts.Timeout); err != nil {
		return fmt.Errorf("pressing %q on element: %w", key, err)
	}

	applySlowMo(h.ctx)

View on GitHub (pinned to 3fcf5388d7)