playwright: Chrome headless (persistent) doesn't save/load cookies on windows

On Windows, headless chrome can’t read cookies from a userdatadir. It is specific to cookies, localStorage works. The Default\Cookies file exists, and is a valid SQLite table, but it has no rows. Launching with headful, I can see the cookie in the SQLite file, but launching headless chrome afterwards clears the file again, and doesn’t read the cookie.

Possibly related to, Puppeteer/Puppeteer#4111, but where that was flaky, this is consistently broken.

#680

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I’m also experiencing this and it’s a bit frustrating 😄

On Linux/MacOS, I do see that it stores session storage is created with headless mode. However on Windows 10, there’s like 1 file in the ‘user-dir’ folder I specify.

Not sure if anyone has a workaround, if I find one I’ll try to post it here.

Same issue on headless Ubuntu Bionic, but with Webkit. The browser context has no cookie, won’t set them after receiving a Set-Cookie header response, and I can’t set them manually neither.

Confirmed, my problem is the same. Take hours to figure this because it works fine on my Ubuntu machine.

@meotimdihia maybe you just got lucky on Ubuntu with an older version of Chromium installed? I cannot get cookies from my —user-data-dir on either Windows or Ubuntu to work when in headless mode.

We need a solution for this issue please

Cookies are missing when running playwright with headless mode enabled. Happened at Chrome 103.0.5060.114 on macOS Big Sur Version 11.6 with M1 Chip.

Why was this issue closed?

We are prioritizing the bugs based on the upvotes, recency and our ability to act. It looks like this issue only has a handful of upvotes, has not been touched recently and/or we lack sufficient feedback to act on it. We are closing issues like this one to keep our bug database maintainable. Please feel free to open a new issue and link this one to it if you think this is a mistake.

Hello guys. Still face it on Version 86.0.4240.75 (Official Build) (64-bit) for Windows 10.

i though i was going crazy, i am on win10 same problem headless true cookies don’t get restored with it false it works fine, is there a workaround?

Confirmed, my problem is the same. Take hours to figure this because it works fine on my Ubuntu machine.