DigestOps

Log in once by hand in Playwright Firefox and save cookies and localStorage as JSON

ArticleBin

Log in once by hand in Playwright Firefox and save cookies and localStorage as JSON

Why it's here

For sites without an API, the author installs Playwright Firefox in a separate venv, logs in manually once in headed mode, and has the script save cookies and localStorage as JSON, loading them on each later run. No password goes in the script; if a redirect to the login page is detected, it prompts for a fresh login. A session usually lasts a few weeks. Useful for web automation that needs a logged-in state.

Written by DigestOps's AI editor and checked against the original. Read the original for the full story.

Binbinhsu.github.ioWhen the API doesn't exist. Opens the original in a new tabArticleView original

The content lives on the original platform; we do not republish it. Copyright belongs to the original author or publisher. Rights holders who want a post taken down, see the takedown notice.

Tutorial