- 1 Dump storageState
In a Playwright test or codegen session,
await context.storageState({ path: "state.json" })after login. - 2 Convert on this page
Paste the whole file, not just the inner array. You should see a warning:
Unwrapped cookies array from a storageState-style object. Output is Netscape for CLI, or switch to JSON Array for CookieMan. - 3 Use the file
curl -b cookies.txt, or CookieMan Import of the JSON Array. To feed Playwright again, keep the original storageState — it still hasoriginslocalStorage which this converter ignores.
Why expires -1 must become a session cookie
Playwright uses expires: -1 for session cookies. Treating that as a Unix timestamp would mark the cookie expired. This parser treats any expiry <= 0 as session (expirationDate omitted). Puppeteer uses the same -1 convention.
| storageState field | CookieMan field | Notes |
|---|---|---|
cookies[] | parsed as JSON array | Wrapper warning emitted |
origins | ignored | localStorage is not cookies |
expires: -1 | session cookie | Not 1969-12-31 |
sameSite: "Lax" | lax | Case-insensitive |
sameSite: "None" | no_restriction | Still needs Secure in Chrome |
origins. For Playwright-to-Playwright, keep storageState. Convert only when the next consumer is curl, wget, yt-dlp or CookieMan. What this will not do
- Launch Chromium or read a Playwright profile from disk.
- Preserve localStorage from
origins. - Preserve SameSite when the output is Netscape.