Skip to content

Persistent Playwright profile loses login cookies after close

Source: Troubleshooting reference

Symptom. A Playwright CLI 0.1.19 profile reopens with local storage intact, but its persistent login cookie has disappeared.

Root cause. The CLI daemon’s context-close callback reenters graceful shutdown. On this Mac the second shutdown force-kills Chrome before cookies are flushed to disk. A persistent profile directory alone does not verify working login persistence.

Fix. df-browser close includes a guarded compatibility adapter for owned sessions. It removes only the known duplicate-shutdown listener before normal close, retaining Playwright’s completion listeners. Unknown implementations leave the profile open with a clear error. The browser workspace guide documents the adapter and the real-browser regression test to run after updates.