grafana/k6 · error

describing DOM node

Error message

describing DOM node: %w

What it means

Returned by ExecutionContext.adoptElementHandle when the CDP dom.DescribeNode call (getting node metadata for the handle being adopted into this context) fails. Wraps the CDP error; usually the handle's remote object became invalid (navigation/detach) or the session errored.

Solutions

  1. Retry adoption once the frame is stable
  2. Re-create the element handle in its own frame before adopting
  3. Check wrapped error for closed-target or session errors
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/execution_context.go:149 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/7ecbd806a5c88616. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/execution_context.go:149

	e.logger.Debugf(
		"ExecutionContext:adoptElementHandle",
		"sid:%s stid:%s fid:%s ectxid:%d furl:%q ehtid:%s ehsid:%s",
		e.sid, e.stid, e.fid, e.id, e.furl,
		efid, esid)

	if eh.execCtx == e {
		return nil, errors.New("already belongs to the same execution context")
	}
	if e.frame == nil {
		return nil, errors.New("does not have a frame owner")
	}

	var node *cdp.Node
	var err error

	action := dom.DescribeNode().WithObjectID(eh.remoteObject.ObjectID)
	if node, err = action.Do(cdp.WithExecutor(e.ctx, e.session)); err != nil {
		return nil, fmt.Errorf("describing DOM node: %w", err)
	}

	return e.adoptBackendNodeID(node.BackendNodeID)
}

// eval evaluates the provided JavaScript within this execution context and
// returns a value or handle.
//
//nolint:funlen
func (e *ExecutionContext) eval(
	apiCtx context.Context, opts evalOptions, js string, args ...any,
) (any, error) {
	if escapesSobekValues(args...) {
		return nil, errors.New("sobek.Value escaped")
	}
	e.logger.Debugf(
		"ExecutionContext:eval",
		"sid:%s stid:%s fid:%s ectxid:%d furl:%q %s",

View on GitHub (pinned to 01ffac6f24)