Dev.to
5/10/2026

"Persisting your real Chrome login across Playwright restarts on macOS"
Short summary
Playwright-driven browser automation on macOS logs out after restart because Playwright's Chrome uses mock keychain encryption while your daily Chrome uses real keychain. Fix: patch Playwright's Chrome flags via sed to swap `--use-mock-keychain` to `--use-real-keychain`, then use SQLite's `.backup` command instead of `cp` to snapshot the live Cookies database without corruption. Two quick fixes enable persistent login profiles.
- •Playwright Chrome uses mock keychain by default, which can't decrypt daily Chrome's cookies
- •Patch Playwright's coreBundle.js with sed to use `--use-real-keychain` instead of `--use-mock-keychain`
- •Use SQLite's `.backup` API instead of `cp` to snapshot live Cookies database without corruption
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



