docs: Playwright-native mode, shadow DOM guide, and demo scripts (Phase 5–8)
Closed
KI
7mo ago+1801+1801+0123456789012345678901234567890123456789-6-6-0123456789
Summary
- New page:
v3/configuration/playwright-native— full guide forbrowserContextoption, camoufox/Firefox setup, page-passing requirement, caching behaviour, and mode comparison table - New page:
v3/best-practices/shadow-dom— open + closed shadow root automation,attachShadowinterceptor pattern, enterprise app troubleshooting (SAP, Salesforce, ServiceNow) - stagehand.mdx — adds
browserContexttoV3Optionsinterface block and<ParamField>section - act / extract / observe refs —
pagetype updated to includePlaywrightNativePage; note thatpagemust be passed explicitly in native mode - configuration/browser.mdx — new "Playwright-Native Mode" section with camoufox quickstart and
cacheDir/ logger notes - best-practices/caching.mdx — new native-mode caching section and
loggersnippet for detecting local cache hits - docs.json —
playwright-nativeadded to Configuration group;shadow-domadded to Best Practices group - Demo scripts (
packages/core/examples/v3/):demo_01_caching.ts— act() cold/warm cache comparison using logger interceptiondemo_02_camoufox_extract.ts— camoufox + observe() + extract() end-to-enddemo_03_shadow_dom.ts—pierceShadow: truevs"including-closed"diff with live node counts
Test plan
- Mintlify preview renders both new pages without broken links
-
v3/configuration/playwright-nativeappears under Configuration in sidebar -
v3/best-practices/shadow-domappears under Best Practices in sidebar -
stagehand.mdxshowsbrowserContextParamField - act/extract/observe refs show
PlaywrightNativePageinpagetype union -
pnpm example v3/demo_01_cachingruns (requiresOPENAI_API_KEY) -
pnpm example v3/demo_03_shadow_domruns (headless, no API key needed)
Closes #17
🤖 Generated with Claude Code
Summary by cubic
Adds full docs for Playwright‑native mode and closed Shadow DOM automation, plus three runnable demos to showcase caching, camoufox/Firefox, and shadow‑piercing.
Clarifies the browserContext option, the need to pass page in native mode, and how local caching works with logger hints.
-
New Features
- New docs pages:
v3/configuration/playwright-nativeandv3/best-practices/shadow-dom. - Updated docs:
stagehandreference addsbrowserContext;act/extract/observereference pages includePlaywrightNativePageand note the explicitpagerequirement;configuration/browseradds a Playwright‑native section; caching guide documents native‑mode local cache and aloggersnippet; navigation updated indocs.json. - New demos in
packages/core/examples/v3/:demo_01_caching.ts(cold vs warm cache),demo_02_camoufox_extract.ts(camoufox + observe/extract),demo_03_shadow_dom.ts(open vs closed shadow diff).
- New docs pages:
-
Migration
- No breaking changes. When using
browserContext, always pass the Playwrightpagetoact()/extract()/observe(). - For closed shadow roots, install the
attachShadowinterceptor viaaddInitScriptbefore navigation to enable"including-closed"piercing.
- No breaking changes. When using