Fix networkidle timeouts and Firefox cookie domain normalization
- Replace networkidle with domcontentloaded + 5s race in goto, click, and session_restore — SPAs with persistent connections (LinkedIn, Gmail) never reach networkidle - Normalize .www. cookie domains in Firefox importer — Playwright silently drops cookies with .www.example.com domains Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vendored
+5
-2
@@ -337,14 +337,17 @@ export class ClaudeBrowser {
|
||||
}
|
||||
async goto(url) {
|
||||
const page = this.ensurePage();
|
||||
await page.goto(url, { waitUntil: 'networkidle' });
|
||||
await page.goto(url, { waitUntil: 'domcontentloaded' });
|
||||
// Best-effort wait for network to settle — SPAs with persistent connections
|
||||
// (LinkedIn, Twitter, Gmail) never reach networkidle, so cap at 5s
|
||||
await Promise.race([page.waitForLoadState('networkidle'), page.waitForTimeout(5000)]).catch(() => { });
|
||||
return { url: page.url(), title: await page.title() };
|
||||
}
|
||||
async click(selector) {
|
||||
const page = this.ensurePage();
|
||||
await this.previewAction(selector, 'CLICK');
|
||||
await page.click(selector);
|
||||
await page.waitForLoadState('networkidle').catch(() => { });
|
||||
await Promise.race([page.waitForLoadState('networkidle'), page.waitForTimeout(5000)]).catch(() => { });
|
||||
return { url: page.url() };
|
||||
}
|
||||
async type(selector, text) {
|
||||
|
||||
Reference in New Issue
Block a user