Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dev-browser install # installs Playwright + Chromium
# Launch a headless browser and run a script
dev-browser --headless <<'EOF'
const page = await browser.getPage("main");
await page.goto("https://example.com");
await page.goto("https://example.com", { waitUntil: "domcontentloaded" });
console.log(await page.title());
EOF

Expand All @@ -42,7 +42,7 @@ EOF
```powershell
@"
const page = await browser.getPage("main");
await page.goto("https://example.com");
await page.goto("https://example.com", { waitUntil: "domcontentloaded" });
console.log(await page.title());
"@ | dev-browser
```
Expand Down
9 changes: 8 additions & 1 deletion cli/llm-guide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ LLM USAGE GUIDE:
}, null, 2));
EOF

Dev server navigation:
For local dev servers (Next.js, Vite, etc.), prefer:
await page.goto(url, { waitUntil: "domcontentloaded" });
The default "load" wait can hang on HMR, streaming, or other long-lived dev-server connections.
Use "load" only when you specifically need every subresource to finish loading.

Error recovery:
If a script fails, the page usually stays where it stopped.
Reconnect to the same page name, take a screenshot, and log the URL/title:
Expand All @@ -74,7 +80,8 @@ LLM USAGE GUIDE:
EOF

Common Playwright Page methods:
page.goto(url) Navigate to a URL
page.goto(url, { waitUntil: "domcontentloaded" })
Navigate to a URL; prefer this on dev servers
page.title() Get the current page title
page.url() Get the current URL
page.snapshotForAI(options) Get an AI-optimized snapshot; returns { full, incremental? }
Expand Down
Loading