You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web trace screenshots can cause React hydration warnings by hiding carets with inline styles #1259
@e2e-dev/web 0.15.2 automatically captures a trace screen after app.open() finishes navigation. On a server-rendered React page, this can precede hydration. capturePixels() passes caret: 'hide' to Playwright, which temporarily changes input and textarea inline styles. React then reports a hydration mismatch even though the application rendered matching HTML.
Reproduction:
Enable trace: 'on' with the web engine and navigate from a loaded page to an SSR React form using app.open().
Attach console/page-error listeners before navigation. Hydration must still be pending when the automatic trace screenshot starts; a scenario's subsequent hydration wait cannot prevent that capture.
Observe the warning below. The same navigation without the automatic capture does not warn.
Sanitized trace:
PlaywrightSurface.open -> acted -> TraceFeed.screenAfterAction
-> captureObservation -> capturePixels
-> page.screenshot({ animations: 'disabled', caret: 'hide', ... })
A tree hydrated but some attributes of the server rendered HTML didn't match the client properties.
<Input>
<input id="instrument-wizard-basics-name" ...>
- style={{caret-color:"transparent"}}
<Textarea>
<textarea id="instrument-wizard-basics-description" ...>
- style={{caret-color:"transparent"}}
Suggested fix: use caret: 'initial' with Playwright's temporary screenshot stylesheet (style: '* { caret-color: transparent !important; }'). This keeps carets out of captured pixels without editing React-owned form attributes. Secure-field masks and trace capture remain enabled. Alternatively, expose a supported pre-capture readiness hook.
Our browser fixture asserts that the navigation emits no console or page errors; the original package fails that assertion. With the stylesheet change, the same fixture and its session setup passed (2 tests, 19 seconds, zero console/page errors), with tracing and secure-field masks still enabled.
Activity