microsoft/playwright · error · Error

Element is not a node

Error message

Element is not a node

What it means

Error "Element is not a node" thrown in microsoft/playwright.

Source

Thrown at packages/playwright-core/src/server/bidi/bidiExecutionContext.ts:145

  async releaseHandle(handle: js.JSHandle): Promise<void> {
    if (!handle._objectId)
      return;
    await this._session.send('script.disown', {
      target: this._target,
      handles: [handle._objectId],
    });
  }

  shouldPrependErrorPrefix(): boolean {
    return false;
  }


  async nodeIdForElementHandle(handle: dom.ElementHandle): Promise<bidi.Script.SharedReference> {
    const shared = await this._remoteValueForReference({ handle: handle._objectId });
    // TODO: store sharedId in the handle.
    if (!('sharedId' in shared))
      throw new Error('Element is not a node');
    return {
      sharedId: shared.sharedId!,
    };
  }

  async remoteObjectForNodeId(context: dom.FrameExecutionContext, nodeId: bidi.Script.SharedReference): Promise<dom.ElementHandle> {
    const result = await this._remoteValueForReference(nodeId, true);
    if (!('handle' in result))
      throw new Error('Can\'t get remote object for nodeId');
    return createHandle(context, result) as dom.ElementHandle;
  }

  async contentFrameIdForFrame(handle: dom.ElementHandle) {
    const contentWindow = await this._rawCallFunction('e => e.contentWindow', [{ handle: handle._objectId }]);
    if (contentWindow?.type === 'window')
      return contentWindow.value.context;
    return null;
  }

View on GitHub (pinned to c8fc3bf8d3)

When it happens

Trigger: Thrown at packages/playwright-core/src/server/bidi/bidiExecutionContext.ts:145 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/5ac157dc3b181e6b. Report an issue: GitHub.