fix: use Playwright channel:chrome instead of broken connectOverCDP

Playwright's connectOverCDP hangs with Chrome 146 due to CDP protocol
version mismatch. Switch to channel:'chrome' which uses Playwright's
native pipe protocol to launch the system Chrome binary directly.

This is simpler and more reliable:
- No CDP port discovery needed
- No --remote-debugging-port or --user-data-dir hassles
- $B connect just works — launches real Chrome headed window
- All Playwright APIs (snapshot, click, fill) work unchanged

bin/chrome-cdp updated with symlinked profile approach (kept for
manual CDP use cases, but $B connect no longer needs it).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-21 12:40:11 -07:00
parent 2fbe7b487b
commit 44797ae957
4 changed files with 60 additions and 118 deletions
+2 -2
View File
@@ -334,12 +334,12 @@ async function start() {
const port = await findPort();
// Launch browser (or connect to existing via CDP)
// Launch browser (headless or real Chrome)
const cdpUrl = process.env.BROWSE_CDP_URL;
const cdpPort = parseInt(process.env.BROWSE_CDP_PORT || '0', 10);
if (cdpUrl) {
await browserManager.connectCDP(cdpUrl, cdpPort);
console.log(`[browse] Connected to real browser via CDP (port ${cdpPort})`);
console.log(`[browse] Launched real Chrome browser (headed)`);
} else {
await browserManager.launch();
}