feat(playwright): adopt per-thread sessions for shared Chrome automation
This commit is contained in:
@@ -21,15 +21,14 @@ description: "Generate images in Gemini web via browser automation, download res
|
||||
- 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-image`
|
||||
|
||||
Quick run:
|
||||
|
||||
```bash
|
||||
export PLAYWRIGHT_SHARED_SESSION=codex-shared
|
||||
python3 scripts/run_image_flow.py \
|
||||
--prompt "生成一张电影感赛博朋克街景海报,夜晚霓虹,雨天反光,纵向构图。" \
|
||||
--target /Users/xd/java/xhs/output/gemini-image \
|
||||
@@ -155,6 +154,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_image_flow.py`: End-to-end runner (login gate, enter image tool, generate, download image, collect files).
|
||||
- `scripts/collect_downloads.py`: Collect recent downloaded images with fallback sources, dedupe, and manifest.
|
||||
|
||||
Reference in New Issue
Block a user