Playwright login session
Skill baronguyen001/ai-automation-skills/skills/playwright-login-session
8 production-tested Claude skills: automation, Gemini cost/structured output, OSS bounty scouting, ML validation.
npx -y skills add baronguyen001/ai-automation-skills --skill playwright-login-sessionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Log in once in a real browser, save the Playwright storage_state, then start every later run already signed in - no re-login, no committed cookies. Use for reuse a logged-in session, skip login on each run, save browser cookies, storage_state, or keep a scraper authenticated.
SKILL.md
2.4 KB, as published. Nobody here has run it
Playwright Login Session
Use this skill when a scraper or automation needs to be signed in and logging in every run is slow, brittle, or triggers bot defenses. Capture the session once (cookies + localStorage) into a storage_state JSON file, then load it on later headless runs so they start authenticated. The state file stays machine-local and gitignored.
When to invoke
- User says: "reuse my logged-in session", "skip the login step each run", "save the browser cookies", "keep the scraper authenticated".
- Code in the conversation re-enters credentials with Playwright on every run.
When NOT to invoke
- The site offers an API token or official API - use that instead of driving a browser.
- Logging in headlessly violates the site's terms, or the account is shared/sensitive enough that storing session state is unsafe.
Concrete example
User input:
My dashboard scraper logs in every time and keeps getting challenged. Reuse the session.
Output:
# one-time: open a real browser, log in by hand, save the session
python assets/session.py capture https://app.example.com/login # -> auth_state.json (gitignored)
# every run after: starts already signed in, headless
python assets/session.py reuse https://app.example.com/dashboard
Pattern to apply
- Capture once with a visible browser and a manual login; save with
context.storage_state(path=...). - Point
PW_STATEat the state file and load it vianew_context(storage_state=...)on later runs. - Gitignore the state file and never commit cookies or credentials - it is a bearer token in disguise.
- Re-capture when the session expires; detect it by checking for a logged-in element after load.
- Pair with proxy rotation when sites fingerprint or rate-limit aggressively (see [[proxy-rotator]]).
Reference: assets/session.py.
Source
Distilled from production use across the author's automation projects. v1.0.0. See also: [[proxy-rotator]], [[webhook-receiver]], [[cron-dispatch]].
→ Build the full runnable bot with Trawlkit.