The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.
JavaScript agent-skillsai-agentautomationbrowserbrowser-automationclaude-codecodexhermes-agentskillsskills-sh
fix(ego-browser): explain URL-object predicates when waitForURL throws
Zhuowei Wang9f0c2a960384
diff --git a/package/ego-browser/src/driver/page-waits.ts b/package/ego-browser/src/driver/page-waits.tsindex 72dd35f..5a74809 100644--- a/package/ego-browser/src/driver/page-waits.ts+++ b/package/ego-browser/src/driver/page-waits.ts@@ -303,7 +303,17 @@ function compilePageURLMatcher(expected: PageURLMatcher): {} catch {return false;}- const result = expected(parsed);+ let result: unknown;+ try {+ result = expected(parsed);+ } catch (error) {+ // Agents often treat the argument as a string (`url.includes(...)`).+ if (!(error instanceof TypeError)) throw error;+ throw new TypeError(+ `page.waitForURL predicate threw: ${error.message}. The predicate receives a URL object; use url.href, url.pathname, or url.searchParams.`,+ { cause: error },+ );+ }if (typeof result !== "boolean") {throw new TypeError("page.waitForURL predicate must return a boolean synchronously",diff --git a/package/ego-browser/src/page-model.test.mjs b/package/ego-browser/src/page-model.test.mjsindex a4d6ed0..f914f0e 100644--- a/package/ego-browser/src/page-model.test.mjs+++ b/package/ego-browser/src/page-model.test.mjs@@ -5054,6 +5054,10 @@ test("Page waitForURL validates its matcher and reports the last URL", async ()() => page.waitForURL(async () => true, { timeout: 10 }),/predicate must return a boolean synchronously/,);+ await assert.rejects(+ () => page.waitForURL((url) => url.includes("/search?"), { timeout: 10 }),+ /url\.includes is not a function.*receives a URL object; use url\.href/,+ );await assert.rejects(() => page.waitForURL("**/{ready", { timeout: 10 }),/Invalid URL glob.*unmatched '\{'/,