Playwright page and frame content can include open shadow roots
Introduced 2026-10-07 · score 0.92
HOW TO USE IT
When serializing page or frame HTML and you need open shadow roots, call `content({ includeShadow: true })`; Playwright emits them as declarative shadow DOM, and closed roots are never included.
const html = await page.content({ includeShadow: true });const html = await frame.content({ includeShadow: true });WHY THIS HELPS
Serialize page or frame content including its open shadow roots.
REQUIREMENTS AND LIMITATIONS
- Version: v1.64.0
- includeShadow: Boolean option, added in v1.64; when true, includes open shadow root contents as nested `<template shadowrootmode="open">`; defaults to false. Closed roots are never included.
- Open shadow roots are serialized as declarative shadow DOM.
FIRST-PARTY EVIDENCE
- https://github.com/microsoft/playwright/releases/tag/v1.64.0
- https://playwright.dev/docs/api/class-page
- https://playwright.dev/docs/api/class-frame
Check the installed version and the source before using it. Entry JSON