46 lines
1.4 KiB
Markdown
46 lines
1.4 KiB
Markdown
---
|
|
name: gmail-browser
|
|
description: Read Gmail emails and threads using a persistent authenticated Chromium session. Use when asked to read, review, or extract content from a Gmail URL.
|
|
version: 1.0.0
|
|
---
|
|
|
|
# Gmail Browser
|
|
|
|
Read Gmail emails via Playwright using a saved auth session (no manual login required).
|
|
|
|
## Auth State
|
|
|
|
Saved at: `~/notes/skills/.playwright-auth/google.json`
|
|
|
|
If the session has expired (redirects to Google sign-in), run the re-auth flow below.
|
|
|
|
## Reading an Email
|
|
|
|
```bash
|
|
# Start a named session with saved auth
|
|
playwright-cli -s=gmail open --persistent 2>&1 &
|
|
sleep 5
|
|
playwright-cli -s=gmail state-load ~/notes/skills/.playwright-auth/google.json
|
|
playwright-cli -s=gmail goto "<gmail_url>"
|
|
|
|
# Extract full email body text
|
|
playwright-cli -s=gmail eval "Array.from(document.querySelectorAll('.a3s')).map(el => el.innerText).join('\n\n---\n\n')"
|
|
|
|
# Close when done
|
|
playwright-cli -s=gmail close
|
|
```
|
|
|
|
## Re-Auth Flow (if session expired)
|
|
|
|
```bash
|
|
playwright-cli -s=gmail open --persistent --headed "https://accounts.google.com"
|
|
# User logs in manually in the browser window
|
|
playwright-cli -s=gmail state-save ~/notes/skills/.playwright-auth/google.json
|
|
playwright-cli -s=gmail close
|
|
```
|
|
|
|
## Notes
|
|
|
|
- The `.a3s` CSS class is Gmail's email body container.
|
|
- The session is saved with `--persistent` so cookies survive restarts as long as state-load is called.
|
|
- Auth state path is gitignored — do not commit it.
|