feat(playwright): adopt per-thread sessions for shared Chrome automation
This commit is contained in:
@@ -21,15 +21,14 @@ description: "Generate music in Gemini web via browser automation, download resu
|
||||
- Ensure browser session can access Gemini (`https://gemini.google.com/app`).
|
||||
- If login, captcha, or MFA is required, pause and ask user to complete it manually.
|
||||
- Use the shared Playwright session policy across all skills:
|
||||
- `export PLAYWRIGHT_SHARED_SESSION=codex-shared`
|
||||
- Invoke Playwright CLI through `/Users/xd/java/xhs/tools/pw` (do not pass `--session` manually).
|
||||
- Auto session policy: `tools/pw` derives one Playwright session per `CODEX_THREAD_ID` (fallback: `PLAYWRIGHT_SESSION_OWNER` or explicit `--session`).
|
||||
- Invoke Playwright CLI through `/Users/xd/java/xhs/tools/pw`; use `--session <name>` only when explicit multi-session isolation is needed.
|
||||
- Decide output directory before generation, for example:
|
||||
- `/Users/xd/java/xhs/output/gemini-music`
|
||||
|
||||
Quick run:
|
||||
|
||||
```bash
|
||||
export PLAYWRIGHT_SHARED_SESSION=codex-shared
|
||||
python3 scripts/run_music_flow.py \
|
||||
--prompt "创作一段 90 BPM 的 lo-fi hiphop,温暖、夜晚、钢琴和刷镲,时长 30 秒。" \
|
||||
--target /Users/xd/java/xhs/output/gemini-music \
|
||||
@@ -156,6 +155,6 @@ Return:
|
||||
|
||||
## Scripts
|
||||
|
||||
- `/Users/xd/java/xhs/tools/pw`: Shared Playwright CLI entrypoint with fixed session + lock.
|
||||
- `/Users/xd/java/xhs/tools/pw`: Shared Playwright CLI entrypoint with per-session lock, auto per-thread session resolution, and shared Chrome CDP defaults.
|
||||
- `scripts/run_music_flow.py`: End-to-end runner (login gate, enter music tool, generate, download MP3, collect files).
|
||||
- `scripts/collect_downloads.py`: Collect recent downloaded audio files with fallback sources, dedupe, and manifest.
|
||||
|
||||
Reference in New Issue
Block a user