openclaw - ✅(Solved) Fix [Bug]: advanced aria-ref snapshot support fails due to missing Playwright _snapshotForAI [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70337Fetched 2026-04-23 07:26:06
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1

refs=aria snapshot mode fails with error indicating missing Playwright _snapshotForAI support after latest OpenClaw update.

Error Message

refs=aria snapshot mode fails with error indicating missing Playwright _snapshotForAI support after latest OpenClaw update. Observe failure during snapshot phase with error referencing _snapshotForAI Observed error message:

Root Cause

This appears to be caused by a dependency on a non-public or unavailable Playwright API (_snapshotForAI). The issue persists across clean installs and environments, suggesting a regression or compatibility issue between OpenClaw and Playwright.

PR fix notes

PR #70461: fix(browser): fall back to ariaSnapshot() when Playwright _snapshotForAI is missing (#70337)

Description (problem / solution / changelog)

Summary

  • Problem: snapshotRoleViaPlaywright with refsMode: "aria" threw refs=aria requires Playwright _snapshotForAI support. whenever the private Playwright helper _snapshotForAI was missing on the underlying Page object. Some Playwright builds (older playwright-core, certain Windows bundle variants — see #70337) ship without it, which surfaced an unactionable error to users who'd never opted into aria refs explicitly: they just hit the default browser-tool path and got a hard failure.
  • Why it matters: The browser tool is the default surface for snapshot-driven automation. A missing private API on a transitive dep shouldn't break a top-level user flow when a perfectly-equivalent public API exists ten lines below in the same function.
  • What changed: Replace the throw with a graceful fallback to the public locator(":root").ariaSnapshot() path that already lives in the same function. Both paths produce role-based refs from the same DOM; the only behavioral difference is that aria refs (aria-ref=N) are downgraded to standard role refs (e<N>). Consumers that hold previously-issued aria refs in memory will see them invalidate after the next snapshot, which mirrors existing behavior when refsMode is changed mid-session.
  • What did NOT change (scope boundary): Selector/frame snapshots with refs=aria still throw (the existing pre-condition check). Removing that requires a parallel implementation of the aria-snapshot tree walk across selector boundaries — much larger scope than this fix.

Change Type (select all)

  • Bug fix

Scope (select all touched areas)

  • Skills / tool execution
  • Integrations

Linked Issue/PR

  • Closes #70337
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: extensions/browser/src/browser/pw-tools-core.snapshot.ts::snapshotRoleViaPlaywright had a hard precondition if (!page._snapshotForAI) throw ... inside the refsMode === "aria" branch. The function already had a working public-API fallback (locator(":root").ariaSnapshot()) further down for the default refsMode path; the aria branch just never delegated to it.
  • Missing detection / guardrail: no test covered the _snapshotForAI === undefined case for the aria branch — every existing test mocked the private helper as present.
  • Contributing context: Playwright's _snapshotForAI is a leading-underscore private API by convention. It's reasonable for it to be missing on some bundles; user-facing tools shouldn't depend on it without a fallback.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
  • Target test file: extensions/browser/src/browser/pw-tools-core.snapshot.aria-fallback.test.ts (new).
  • Scenario the test should lock in:
    • When _snapshotForAI is present, prefer it (existing path stays intact)
    • When _snapshotForAI is absent, silently fall back to locator(":root").ariaSnapshot() and return a role-based snapshot
    • Selector/frame snapshots with refs=aria still throw (out-of-scope assertion)
  • Why this is the smallest reliable guardrail: the fallback decision is a single conditional inside one function; three matrix cases cover the full decision table.
  • Existing test that already covers this (if any): none — every existing mock had _snapshotForAI populated.

User-visible / Behavior Changes

  • Browser tool calls with refs=aria no longer fail on Playwright builds without _snapshotForAI. They return role-based refs (e<N>) instead of aria refs (aria-ref=N) on the fallback path.
  • No config change. No public API change.

Diagram (if applicable)

Before:
  snapshotRoleViaPlaywright({ refsMode: "aria" })
    -> if (!page._snapshotForAI) throw "refs=aria requires Playwright _snapshotForAI support."

After:
  snapshotRoleViaPlaywright({ refsMode: "aria" })
    -> if  (page._snapshotForAI) -> use it (existing path, returns aria refs)
    -> else fall through to locator(":root").ariaSnapshot()
                              -> existing role-snapshot path (returns role refs)

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • The fallback path was already reachable via the default refsMode and is exercised by all existing role-snapshot tests; this PR just makes the aria branch delegate to the same code instead of throwing.

Repro + Verification

Environment

  • OS: macOS 26.5 (arm64)
  • Runtime/container: Node v25.9.0, OpenClaw main @ HEAD
  • Playwright build: any bundle missing the private _snapshotForAI helper
  • Integration/channel (if any): browser tool

Steps

  1. Use a Playwright build whose Page does not expose _snapshotForAI.
  2. Call the browser tool's snapshot action with refs=aria (the default for some flows that route through snapshotRoleViaPlaywright).

Expected

  • Snapshot succeeds; refs are role-based (e<N>).

Actual (before fix)

  • Throws refs=aria requires Playwright _snapshotForAI support. — surfaced to the user with no actionable next step.

Actual (after fix)

  • Snapshot succeeds via locator(":root").ariaSnapshot(). Refs are role-based (e<N>); the snapshot stat shape, ref dictionary contract, and storeRoleRefsForTarget call are all unchanged.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets

Type-check (file-scoped, modules-only failures from missing dev deps in tmp clone, ignore):

$ npx -p typescript@5 tsc --noEmit --skipLibCheck \
    --target ES2022 --module ESNext --moduleResolution Bundler \
    --esModuleInterop --strict \
    extensions/browser/src/browser/pw-tools-core.snapshot.ts 2>&1 \
  | grep "pw-tools-core.snapshot.ts"
extensions/browser/src/browser/pw-tools-core.snapshot.ts(1,41): error TS2307: Cannot find module 'openclaw/plugin-sdk/text-runtime'
extensions/browser/src/browser/pw-tools-core.snapshot.ts(299,23): error TS2580: Cannot find name 'Buffer'

Both errors are missing transitive types (the tmp clone has no node_modules), not new errors introduced by this PR.

New regression suite (3 cases) — wired against the existing pw-tools-core mock harness; ready to be picked up by vitest.extension-browser.config.ts:

TestAsserts
uses _snapshotForAI when available (no fallback needed)Existing path still preferred when private helper is present
falls back to ariaSnapshot when _snapshotForAI is missingFallback runs, locator(":root").ariaSnapshot() is called, function returns a snapshot
still rejects refs=aria + selector snapshots (out of scope for fallback)Pre-existing precondition for selector/frame snapshots is preserved

Human Verification (required)

  • Verified scenarios: read through the existing snapshotRoleViaPlaywright flow end-to-end; confirmed the fallback path it now delegates to is the same code that handles the default refsMode (so this isn't a new code path under the hood — it's the existing one). Wrote and reviewed three regression tests against the established pw-session.js / pw-session.page-cdp.js mock pattern used by pw-tools-core.browser-ssrf-guard.test.ts.
  • Edge cases checked:
    • _snapshotForAI present → preferred (no behavior change)
    • _snapshotForAI undefined → falls back, snapshot still returned
    • selector/frame + refs=aria → still rejected (pre-existing precondition preserved)
  • What I did NOT verify: running the full vitest.extension-browser.config.ts suite locally — the tmp clone doesn't have node_modules installed and disk pressure on this workstation made a fresh pnpm install undesirable. CI on this PR will run the suite. The behavior change is a single conditional and the regression cases pin it precisely; happy to push fixups if CI surfaces anything.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • Callers that previously caught the refs=aria requires Playwright _snapshotForAI support. error string will no longer see it. That's the intended behavior change — the error string was surfaced to users, not to programmatic callers.

Risks and Mitigations

  • Risk: silent ref-shape change — a caller hard-coded against aria-ref=N ref shapes would break when the fallback engages.
    • Mitigation: existing aria-ref callers were already coexisting with the role-ref shape returned by the default refsMode; the snapshot output uses the same storeRoleRefsForTarget path so downstream act calls keep working without surgery. The only observable effect is that a previously-issued aria-ref becomes invalid after the next snapshot, which already happens when callers switch refsMode mid-session.
  • Risk: fallback masks a genuinely-broken Playwright bundle that was throwing for a reason.
    • Mitigation: the fallback uses Playwright's public ariaSnapshot() API. If that's also broken on the same bundle, the existing role-snapshot path was already broken for every other caller — this PR doesn't widen that exposure.

Changed files

  • extensions/browser/src/browser/pw-tools-core.snapshot.aria-fallback.test.ts (added, +117/-0)
  • extensions/browser/src/browser/pw-tools-core.snapshot.ts (modified, +26/-19)

Code Example

Logs, screenshots, and evidence

Observed error message:

refs=aria requires Playwright _snapshotForAI support
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

refs=aria snapshot mode fails with error indicating missing Playwright _snapshotForAI support after latest OpenClaw update.

Steps to reproduce

Steps to reproduce* Run OpenClaw with a workflow that uses refs=aria Trigger a browser snapshot action Observe failure during snapshot phase with error referencing _snapshotForAI

Expected behavior

Expected behavior*

ARIA-based snapshot references (refs=aria) should function correctly as part of OpenClaw’s browser automation, or fall back to standard snapshot behavior if unsupported.

Actual behavior

Actual behavior*

OpenClaw fails immediately when refs=aria is used, returning:

refs=aria requires Playwright _snapshotForAI support

Standard (non-ARIA) snapshot functionality continues to work.

OpenClaw version

v2026 4.21

Operating system

Windows 11 Version 25

Install method

npm global

Model

Open AI 5.4

Provider / routing chain

Provider / routing chain* Direct local execution (no external provider routing, proxies, or gateways observed)

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

Logs, screenshots, and evidence

Observed error message:

refs=aria requires Playwright _snapshotForAI support

Impact and severity

Impact and severity Affected users: Any users relying on refs=aria snapshot mode Severity: Blocks workflow (ARIA-based automation fails completely) Frequency: Always reproducible when using refs=aria Consequence: Prevents use of accessibility-aware UI navigation and breaks certain automation flows

Additional information

Additional information

This appears to be caused by a dependency on a non-public or unavailable Playwright API (_snapshotForAI). The issue persists across clean installs and environments, suggesting a regression or compatibility issue between OpenClaw and Playwright.

extent analysis

TL;DR

The most likely fix is to update or modify OpenClaw to remove its dependency on the non-public Playwright _snapshotForAI API or to use a version of Playwright that supports this API.

Guidance

  • Verify the version of Playwright being used by OpenClaw to ensure it is compatible with the _snapshotForAI API.
  • Check the OpenClaw documentation or source code to see if there are any configuration options or workarounds for using refs=aria without the _snapshotForAI API.
  • Consider downgrading OpenClaw to a version that does not rely on the _snapshotForAI API, if available.
  • If possible, test OpenClaw with a different version of Playwright to see if the issue is resolved.

Example

No code example is provided as the issue does not specify the exact code changes required to fix the problem.

Notes

The solution may require updates to OpenClaw or Playwright, and may involve waiting for a new release that addresses the compatibility issue. Additionally, the lack of information about the NOT_ENOUGH_INFO section may limit the ability to provide a complete solution.

Recommendation

Apply workaround: Remove or bypass the refs=aria snapshot mode until a compatible version of OpenClaw or Playwright is available, as this is a regression that blocks workflow and has a high severity impact.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected behavior*

ARIA-based snapshot references (refs=aria) should function correctly as part of OpenClaw’s browser automation, or fall back to standard snapshot behavior if unsupported.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: advanced aria-ref snapshot support fails due to missing Playwright _snapshotForAI [1 pull requests, 1 participants]