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 shadow selectors and popup URL waits
Autecb7e779eb0c7
diff --git a/docs/runtime-v2-architecture.md b/docs/runtime-v2-architecture.mdindex 261a210..7e827c5 100644--- a/docs/runtime-v2-architecture.md+++ b/docs/runtime-v2-architecture.md@@ -248,6 +248,7 @@ await page.goto(url, { timeout })await page.snapshot(options)await page.screenshot({ path, fullPage, clip, raw })await page.url()+await page.waitForURL(urlOrRegExp, { timeout })await page.title()await page.info()await page.evaluate(fnOrString, arg?)@@ -274,6 +275,11 @@ await page.close()`screenshot()` 和 `waitForSelector()` 使用 Playwright 风格的参数。截图路径放在options 中;`fullPage` 表示捕获完整页面。`waitForSelector()` 的 `state` 支持`attached`、`detached`、`visible` 和 `hidden`,默认是 `visible`。+`waitForURL()` 接受完整 URL 字符串或正则表达式,默认等待 10,000ms。++CSS selector 会在 document 和每一层 open shadow root 中查找,因而 Shadow DOM+节点也可以通过 `loc=css:` 或 raw CSS 操作。selector 应描述元素在自身 tree scope+内的结构;XPath 和 closed shadow root 不跨 shadow boundary。文件上传不操作系统文件选择器。已有 file input 时,`setInputFiles()` 直接设置文件;网站点击后才创建 input 时,先建立 `waitForFileChooser()`,再点击并通过@@ -344,7 +350,7 @@ Ego Lite 更新 Agent 光标。`fill()` 只更新可见光标,不会额外向- selector action 和 wait- mouse、keyboard、scrollBy-`url()`、`title()`、`info()` 和 `events()` 是纯读取,不改变当前激活页。+`url()`、`waitForURL()`、`title()`、`info()` 和 `events()` 不改变当前激活页。激活目标页是有意行为。真实 Ego Lite 测试中,后台页输入曾出现 CDP 超时并退化为 `isTrusted=false` 的合成事件;激活后可保持正常 CDP Input 路径。@@ -362,7 +368,9 @@ popup 回执:```高层动作只比较动作前后的 tab 列表,不向页面安装观察脚本。导航、表单和 DOM-结果应通过 `url()`、`waitForSelector()`、`snapshot()` 或读取页面状态确认。+结果应通过 `url()`、`waitForURL()`、`waitForSelector()`、`snapshot()` 或读取页面+状态确认。popup 回执只表示 target 已收编;首次导航可能仍停留在 `about:blank`,+需要目的 URL 时由调用方显式等待。同步 JavaScript dialog 会阻塞触发它的 CDP 输入响应。Runtime 收到`Page.javascriptDialogOpening` 后会中断该输入等待,让高层动作立即返回diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/index.mjsindex b5278f8..34d7c5b 100644--- a/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs+++ b/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs@@ -13,6 +13,7 @@ import { pageJavaScriptDialogsCase } from "./page-dialogs.mjs";import { pageMediaPlaybackCase } from "./page-media-playback.mjs";import { pageScrolledScreenshotCase } from "./page-screenshot.mjs";import { pageSnapshotLocatorCase } from "./page-snapshot-locators.mjs";+import { pageShadowDomCase } from "./page-shadow-dom.mjs";import { pageLoadStatesCase } from "./page-load-states.mjs";import { runtimeCase } from "./runtime.mjs";import { runtimeRegressionCase } from "./runtime-regression.mjs";@@ -76,6 +77,7 @@ export const e2eCases = [{ name: "Page media playback", body: pageMediaPlaybackCase },{ name: "Page scrolled screenshot", body: pageScrolledScreenshotCase },{ name: "Page snapshot locator quality", body: pageSnapshotLocatorCase },+ { name: "Page open Shadow DOM locators", body: pageShadowDomCase },{ name: "Page load states", body: pageLoadStatesCase },{ name: "v1 and v2 action parity", body: v1V2ActionParityCase },{ name: "portable keyboard workflow", body: portableKeyboardWorkflowCase },diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/page-load-states.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/page-load-states.mjsindex 452b0b9..92772b9 100644--- a/package/ego-browser/scripts/real-browser-e2e/cases/page-load-states.mjs+++ b/package/ego-browser/scripts/real-browser-e2e/cases/page-load-states.mjs@@ -34,6 +34,31 @@ export function pageLoadStatesCase() {"load resolves after the slow resource finishes");+ await page.evaluate((popupUrl) => {+ const button = document.createElement("button");+ button.id = "delayed-popup";+ button.textContent = "Open delayed popup";+ button.style.cssText = "position:fixed;left:20px;top:20px;z-index:2147483647";+ button.addEventListener("click", () => {+ const popup = window.open("about:blank", "_blank");+ setTimeout(() => {+ popup.location.href = popupUrl;+ }, 750);+ });+ document.body.append(button);+ }, baseUrl + "/secondary?page-load-states=delayed-popup");+ const receipt = await page.click("#delayed-popup");+ assertEqual(receipt.popups.length, 1, "the delayed popup is adopted immediately");+ const popup = task.page(receipt.popups[0].label);+ assertEqual(await popup.url(), "about:blank", "the adopted popup begins at about:blank");+ await popup.waitForURL(/page-load-states=delayed-popup$/, { timeout: 3_000 });+ assertIncludes(+ await popup.url(),+ "page-load-states=delayed-popup",+ "waitForURL follows the popup's first navigation"+ );++ await popup.close();await page.close();`;}diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/page-shadow-dom.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/page-shadow-dom.mjsnew file mode 100644index 0000000..6b9252a--- /dev/null+++ b/package/ego-browser/scripts/real-browser-e2e/cases/page-shadow-dom.mjs@@ -0,0 +1,37 @@+export function pageShadowDomCase() {+ return `+ const task = await taskSpace(taskName);+ const page = await task.openPage(baseUrl + "/?page=shadow-dom", { as: "shadow-dom" });+ try {+ const snapshot = await page.snapshot();+ assertIncludes(snapshot, "Shadow field", "snapshot exposes the shadow input");++ await page.fill('loc=css:input[aria-label="Shadow field"]', "shadow value");+ assertEqual(+ await page.evaluate(() =>+ document+ .querySelector("#shadow-fixture")+ .shadowRoot.querySelector('input[aria-label="Shadow field"]')+ .value+ ),+ "shadow value",+ "snapshot-style CSS locators resolve inside an open shadow root"+ );++ await page.click("#shadow-action");+ assertEqual(+ await page.evaluate(() =>+ document+ .querySelector("#shadow-fixture")+ .shadowRoot.querySelector("nested-shadow-fixture")+ .shadowRoot.querySelector("#shadow-action")+ .dataset.clicked+ ),+ "true",+ "raw CSS selectors resolve controls inside nested open shadow roots"+ );+ } finally {+ await page.close();+ }+ `;+}diff --git a/package/ego-browser/scripts/real-browser-e2e/fixture.mjs b/package/ego-browser/scripts/real-browser-e2e/fixture.mjsindex 7b49d4a..69a9df5 100644--- a/package/ego-browser/scripts/real-browser-e2e/fixture.mjs+++ b/package/ego-browser/scripts/real-browser-e2e/fixture.mjs@@ -347,6 +347,7 @@ function pageHtml(kind, { iframeUrl = "/frame.html" } = {}) {<label>Number input <input id="number-input" type="number" value="123"></label><label>Controlled input <input id="controlled-input" type="text"></label><span id="controlled-state"></span>+ <shadow-fixture id="shadow-fixture"></shadow-fixture>${kind === "frame" ? '<div id="iframe-marker" data-iframe="true" style="border:2px solid #44f;padding:8px;margin-top:8px;">iframe target</div>' : ""}</main><script>@@ -367,6 +368,21 @@ function pageHtml(kind, { iframeUrl = "/frame.html" } = {}) {dropdownValue: "alpha",valueEvents: {},};+ const shadowHost = document.querySelector("#shadow-fixture");+ const shadowRoot = shadowHost.attachShadow({ mode: "open" });+ const nestedHost = document.createElement("nested-shadow-fixture");+ shadowRoot.append(nestedHost);+ const nestedShadowRoot = nestedHost.attachShadow({ mode: "open" });+ const shadowInput = document.createElement("input");+ shadowInput.setAttribute("aria-label", "Shadow field");+ shadowRoot.prepend(shadowInput);+ const shadowButton = document.createElement("button");+ shadowButton.id = "shadow-action";+ shadowButton.textContent = "Shadow action";+ shadowButton.addEventListener("click", () => {+ shadowButton.dataset.clicked = "true";+ });+ nestedShadowRoot.append(shadowButton);const count = document.querySelector("#click-count");const clickButton = document.querySelector("#click-button");for (const type of ["mousemove", "mousedown", "mouseup", "click", "dblclick"]) {diff --git a/package/ego-browser/src/driver/page-waits.ts b/package/ego-browser/src/driver/page-waits.tsindex c3139e4..a2bf938 100644--- a/package/ego-browser/src/driver/page-waits.ts+++ b/package/ego-browser/src/driver/page-waits.ts@@ -27,6 +27,10 @@ export type PageWaitForLoadStateOptions = {idleMs?: number;};+export type PageWaitForURLOptions = {+ timeout?: number;+};+const VISIBILITY_FUNCTION ="function(){if(typeof this.checkVisibility==='function')return this.checkVisibility({checkOpacity:true,checkVisibilityCSS:true});const s=getComputedStyle(this);const r=this.getBoundingClientRect();return s.display!=='none'&&s.visibility!=='hidden'&&s.opacity!=='0'&&r.width>0&&r.height>0;}";@@ -99,6 +103,69 @@ export async function waitForSelectorInPage();}+/** Wait until one Page reaches an exact URL or matches a regular expression. */+export async function waitForURLInPage(+ services: PageWaitServices,+ sessionId: string,+ expected: string | RegExp,+ options: PageWaitForURLOptions = {},+): Promise<void> {+ if (+ !(+ (typeof expected === "string" && expected.length > 0) ||+ expected instanceof RegExp+ )+ ) {+ throw new TypeError(+ "page.waitForURL expected URL must be a non-empty string or RegExp",+ );+ }+ const timeoutMs = options.timeout ?? 10_000;+ const pattern =+ expected instanceof RegExp+ ? new RegExp(expected.source, expected.flags)+ : undefined;+ const deadline = services.now() + timeoutMs;+ let lastUrl = "";+ while (services.now() <= deadline) {+ const remaining = Math.max(1, deadline - services.now());+ let response;+ try {+ response = await services.cdp(+ "Runtime.evaluate",+ { expression: "location.href", returnByValue: true },+ sessionId,+ Math.min(1_000, remaining),+ );+ } catch (error) {+ if (isRuntimeEvaluateTimeout(error)) {+ if (services.now() >= deadline) break;+ } else if (!isTransientNavigationContextError(error)) {+ throw error;+ }+ }+ if (typeof response?.result?.value === "string") {+ lastUrl = response.result.value;+ if (typeof expected === "string") {+ if (lastUrl === expected) return;+ } else {+ pattern!.lastIndex = 0;+ if (pattern!.test(lastUrl)) return;+ }+ }+ const waitMs = deadline - services.now();+ if (waitMs <= 0) break;+ await services.sleep(Math.min(100, waitMs));+ }+ const expectation =+ typeof expected === "string"+ ? JSON.stringify(expected)+ : expected.toString();+ throw new Error(+ `page.waitForURL timed out after ${timeoutMs}ms: expected ${expectation}; last URL was ${JSON.stringify(lastUrl)}`,+ );+}+/** Wait for document load or network idle inside one Page session. */export async function waitForLoadStateInPage(services: PageWaitServices,@@ -180,6 +247,15 @@ function isRuntimeEvaluateTimeout(error: unknown): boolean {);}+function isTransientNavigationContextError(error: unknown): boolean {+ if (!(error instanceof Error)) return false;+ return (+ error.message.includes("Execution context was destroyed") ||+ error.message.includes("Cannot find context with specified id") ||+ error.message.includes("Inspected target navigated")+ );+}+async function waitForNetworkIdle(services: PageWaitServices,sessionId: string,diff --git a/package/ego-browser/src/element-resolver.test.mjs b/package/ego-browser/src/element-resolver.test.mjsindex 885cf76..5f4f88c 100644--- a/package/ego-browser/src/element-resolver.test.mjs+++ b/package/ego-browser/src/element-resolver.test.mjs@@ -119,3 +119,26 @@ test("role locator with degenerate box model throws transient", async () => {},);});++test("CSS locators search nested open shadow roots", async () => {+ const cdp = new FakeCDP(async (method, params) => {+ if (method === "Runtime.evaluate") {+ assert.match(+ params.expression,+ /shadowRoot/,+ "the CSS query must visit open shadow roots instead of using only document.querySelectorAll",+ );+ return { result: { value: { x: 12, y: 34 } } };+ }+ return {};+ });++ const point = await resolveElementCenter(+ cdp,+ undefined,+ new RefMap(),+ 'loc=css:input[aria-label="Shadow field"]',+ );++ assert.deepEqual(point, { x: 12, y: 34, sessionId: undefined });+});diff --git a/package/ego-browser/src/element-resolver.ts b/package/ego-browser/src/element-resolver.tsindex cfebdcc..594c0a8 100644--- a/package/ego-browser/src/element-resolver.ts+++ b/package/ego-browser/src/element-resolver.ts@@ -441,19 +441,19 @@ function buildFindElementJs(selector) {if (String(selector).startsWith("xpath=")) {return `document.evaluate(${JSON.stringify(String(selector).slice(6))}, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue`;}- return `document.querySelector(${JSON.stringify(selector)})`;+ return buildCssFindJs(selector);}function buildLocatorFindJs(locator) {if (locator.kind === "css") {- return `document.querySelector(${JSON.stringify(locator.selector)})`;+ return buildCssFindJs(locator.selector);}return `(() => ${hrefElementsJs(locator.href)}[0] || null)()`;}function buildLocatorCountJs(locator) {if (locator.kind === "css") {- return `document.querySelectorAll(${JSON.stringify(locator.selector)}).length`;+ return buildCssCountJs(locator.selector);}return `(() => ${hrefElementsJs(locator.href)}.length)()`;}@@ -470,7 +470,7 @@ function buildLocatorCenterJs(locator) {}function hrefElementsJs(href) {- return `Array.from(document.querySelectorAll('a[href]')).filter((el) => {+ return `${buildCssQueryAllJs("a[href]")}.filter((el) => {try {const u = new URL(el.href, location.href);const path = u.pathname + u.search + u.hash;@@ -481,6 +481,47 @@ function hrefElementsJs(href) {})`;}+// CSS locators from the native snapshot can point into an open shadow tree.+// Query every reachable tree scope so those locators have the same meaning+// when an action reuses them. XPath deliberately keeps document-only semantics.+const OPEN_SHADOW_QUERY_HELPER = `+ function __egoQueryAllOpenShadow(selector) {+ const matches = [];+ const roots = [document];+ while (roots.length) {+ const root = roots.pop();+ matches.push(...root.querySelectorAll(selector));+ const elements = root.querySelectorAll('*');+ for (let index = elements.length - 1; index >= 0; index -= 1) {+ const shadowRoot = elements[index].shadowRoot;+ if (shadowRoot) roots.push(shadowRoot);+ }+ }+ return matches;+ }+`;++function buildCssQueryAllJs(selector) {+ return `(() => {+ ${OPEN_SHADOW_QUERY_HELPER}+ return __egoQueryAllOpenShadow(${JSON.stringify(selector)});+ })()`;+}++function buildCssFindJs(selector) {+ return `(() => {+ ${OPEN_SHADOW_QUERY_HELPER}+ return __egoQueryAllOpenShadow(${JSON.stringify(selector)})[0] || null;+ })()`;+}++function buildCssCountJs(selector) {+ return `(() => {+ ${OPEN_SHADOW_QUERY_HELPER}+ return __egoQueryAllOpenShadow(${JSON.stringify(selector)}).length;+ })()`;+}+function buildSelectorCenterJs(selector) {const findExpr = buildFindElementJs(selector);return `(() => {diff --git a/package/ego-browser/src/page-model.test.mjs b/package/ego-browser/src/page-model.test.mjsindex 4893c4d..0e5e0ea 100644--- a/package/ego-browser/src/page-model.test.mjs+++ b/package/ego-browser/src/page-model.test.mjs@@ -42,6 +42,7 @@ function createFixture(rootDir) {let documentReadyState = "complete";let domContentLoaded = true;let timeoutNextLifecycleEvaluate = false;+ let timeoutNextUrlEvaluate = false;let nowMs = 1_000;const pageEvents = new Map();const networkSessions = new Set();@@ -125,6 +126,11 @@ function createFixture(rootDir) {};}if (params.expression === "location.href") {+ if (timeoutNextUrlEvaluate) {+ timeoutNextUrlEvaluate = false;+ nowMs += timeoutMs ?? 0;+ throw new Error("CDP request timed out: Runtime.evaluate");+ }return { result: { type: "string", value: tab.url } };}if (params.expression === "document.title") {@@ -484,6 +490,9 @@ function createFixture(rootDir) {timeoutNextLifecycleEvaluation() {timeoutNextLifecycleEvaluate = true;},+ timeoutNextUrlEvaluation() {+ timeoutNextUrlEvaluate = true;+ },setSession(targetId, sessionId) {sessionOverrides.set(targetId, sessionId);},@@ -1902,6 +1911,87 @@ test("Page waits and events remain isolated to the addressed target", async () =});});+test("Page waitForURL follows a popup from about:blank without activating it", async () => {+ await withFixture(async (fixture) => {+ let elapsedMs = 0;+ let popupTargetId;+ const expectedUrl = "https://example.test/delayed-popup";+ const task = taskForRound(fixture, "round-a", {+ now: () => elapsedMs,+ async sleep(ms) {+ elapsedMs += ms;+ if (popupTargetId && elapsedMs >= 150) {+ fixture.tabs.get(popupTargetId).url = expectedUrl;+ }+ },+ });+ const source = await task.openPage("https://example.test/source");+ fixture.openPopupOnNextClick("about:blank");+ const receipt = await source.click("#open-popup");+ popupTargetId = receipt.popups[0].targetId;+ const popup = task.page(receipt.popups[0].label);+ fixture.addExternalTab("target-user", "https://example.test/user", {+ active: true,+ });+ const activationCallsBefore = fixture.calls.filter(+ ([kind, method]) => kind === "cdp" && method === "Target.activateTarget",+ ).length;++ await popup.waitForURL(expectedUrl, { timeout: 500 });+ await popup.waitForURL(/delayed-popup$/, { timeout: 1 });++ assert.equal(await popup.url(), expectedUrl);+ assert.equal(+ fixture.activeTarget(),+ "target-user",+ "waiting for a URL must not steal the active tab",+ );+ assert.equal(+ fixture.calls.filter(+ ([kind, method]) =>+ kind === "cdp" && method === "Target.activateTarget",+ ).length,+ activationCallsBefore,+ );+ });+});++test("Page waitForURL validates its matcher and reports the last URL", async () => {+ await withFixture(async (fixture) => {+ const task = taskForRound(fixture, "round-a");+ const page = await task.openPage("about:blank");++ await assert.rejects(+ () => page.waitForURL("https://example.test/never", { timeout: 10 }),+ /waitForURL timed out after 10ms.*last URL was "about:blank"/,+ );+ await assert.rejects(+ () => page.waitForURL("", { timeout: 10 }),+ /non-empty string or RegExp/,+ );+ await assert.rejects(+ () => page.waitForURL(42, { timeout: 10 }),+ /non-empty string or RegExp/,+ );+ await assert.rejects(+ () => page.waitForURL(/blank/, { timeout: 0 }),+ /positive number of milliseconds/,+ );+ });+});++test("Page waitForURL retries a transient evaluation timeout", async () => {+ await withFixture(async (fixture) => {+ const expectedUrl = "https://example.test/after-timeout";+ const task = taskForRound(fixture, "round-a");+ const page = await task.openPage(expectedUrl);+ fixture.timeoutNextUrlEvaluation();++ await page.waitForURL(expectedUrl, { timeout: 2_000 });+ assert.equal(await page.url(), expectedUrl);+ });+});+test("Page waitForSelector supports Playwright-style element states", async () => {await withFixture(async (fixture) => {const task = taskForRound(fixture, "round-a");diff --git a/package/ego-browser/src/page-model.ts b/package/ego-browser/src/page-model.tsindex 7f2fdc4..67dbfa5 100644--- a/package/ego-browser/src/page-model.ts+++ b/package/ego-browser/src/page-model.ts@@ -51,8 +51,10 @@ import {import {waitForLoadStateInPage,waitForSelectorInPage,+ waitForURLInPage,type PageWaitForLoadStateOptions,type PageWaitForSelectorOptions,+ type PageWaitForURLOptions,} from "./driver/page-waits.js";import { assertNoEgoError, isEgoUserControlError } from "./ego-errors.js";import {@@ -1033,6 +1035,17 @@ class Page {return this.#evaluate("location.href", false);}+ async waitForURL(+ expected: string | RegExp,+ options: PageWaitForURLOptions = {},+ ): Promise<void> {+ validatePublicApiOptions("Page.waitForURL", options);+ const page = await this.#resolve();+ return this.#services.gate.withPage(page, ({ sessionId }) =>+ waitForURLInPage(this.#services, sessionId, expected, options),+ );+ }+async title(): Promise<string> {return this.#evaluate("document.title", false);}diff --git a/package/ego-browser/src/public-api-schema.test.mjs b/package/ego-browser/src/public-api-schema.test.mjsindex 17406b6..def002c 100644--- a/package/ego-browser/src/public-api-schema.test.mjs+++ b/package/ego-browser/src/public-api-schema.test.mjs@@ -18,6 +18,7 @@ test("the public API schema contains the v2 entry points and object methods", ()"TaskSpace.openPage","Page.snapshot","Page.targetId",+ "Page.waitForURL","Page.keyboard.press",]) {assert(names.has(name), `missing public API schema entry: ${name}`);diff --git a/package/ego-browser/src/public-api-schema.ts b/package/ego-browser/src/public-api-schema.tsindex 53b8d32..6dff393 100644--- a/package/ego-browser/src/public-api-schema.ts+++ b/package/ego-browser/src/public-api-schema.ts@@ -203,6 +203,12 @@ export const PUBLIC_API_SCHEMA: readonly PublicApiEntry[] = [signature: "await page.url()",summary: "Read this Page's current URL.",},+ {+ name: "Page.waitForURL",+ signature: "await page.waitForURL(urlOrRegExp, { timeout? })",+ summary: "Wait for an exact URL or regular-expression match.",+ options: { timeout },+ },{name: "Page.title",signature: "await page.title()",diff --git a/skills/ego-browser/SKILL.md b/skills/ego-browser/SKILL.mdindex 8625387..5221322 100644--- a/skills/ego-browser/SKILL.md+++ b/skills/ego-browser/SKILL.md@@ -107,11 +107,15 @@ New tabs opened by high-level actions receive labels automatically and may appeaconst receipt = await page.click('a[target="_blank"]');for (const popup of receipt.popups ?? []) {const popupPage = task.page(popup.label);+ await popupPage.waitForURL(/\/expected-path(?:[?#]|$)/, { timeout: 10_000 });console.log({ popup: popup.label, url: await popupPage.url() });}```-A popup that propagates slowly will be discovered by the next `listPages()` or `openPage()` call, or when the task resumes in a later round.+The receipt confirms that the popup target was adopted; its first navigation may+still be at `about:blank`. Use `waitForURL()` when the destination matters. A+popup that propagates slowly will be discovered by the next `listPages()` or+`openPage()` call, or when the task resumes in a later round.## Choose an interaction path@@ -134,6 +138,10 @@ Page actions accept these selectors:- `xpath=...`- raw CSS selectors+CSS selectors search the document and every nested open shadow root. Write the+selector for the element's own tree scope; XPath and closed shadow roots do not+cross a shadow boundary.+Snapshot node labels such as `button` and `textbox` are accessibility roles,not necessarily HTML tag names. Use the current `@N` for an immediate action,prefer a generated `loc=role:` for semantic reuse, and use CSS only when the@@ -217,6 +225,7 @@ await page.screenshot({await page.evaluate(fnOrString, argument);await page.fetch(url, options);await page.cdp(method, params, { timeout });+await page.waitForURL(urlOrRegExp, { timeout });await page.waitForSelector(selector, { timeout, state });await page.waitForLoadState(state, { timeout, idleMs });await page.setInputFiles(selector, pathOrPaths);@@ -229,6 +238,8 @@ await page.close();```- `goto()` defaults to `timeout: 15_000`.+- `waitForURL()` accepts an exact URL string or a `RegExp`, defaults to+ `timeout: 10_000`, and does not activate the Page.- `snapshot()` defaults to `{ scope: "full_page", includeActionMarks: true, includeStableLocator: true }`. `scope` is `"full_page"` or `"only_within_viewport"`; there is no `diff` option.- Omit `screenshot()`'s `path` to receive a temporary PNG path; provided paths should be absolute. `clip.scale` is optional and positive. `raw` defaults to `false`; set it only for uncorrected device-pixel output.- `evaluate()` accepts a function with at most one JSON-serializable argument, or a string expression with no argument. Its return value must also be JSON-serializable.diff --git a/skills/ego-browser/references/api.md b/skills/ego-browser/references/api.mdindex 7cadbc5..7618b12 100644--- a/skills/ego-browser/references/api.md+++ b/skills/ego-browser/references/api.md@@ -45,6 +45,7 @@ High-level Page actions return a receipt that may contain `popups` or a synchron| `await page.snapshot({ scope?, includeActionMarks?, includeStableLocator? })` | `scope` (full_page, only_within_viewport) — Snapshot scope.<br>`includeActionMarks` — Include action marks.<br>`includeStableLocator` — Include stable locators. | Return a full semantic snapshot with Page provenance. || `await page.screenshot({ path?, fullPage?, clip?, raw? })` | `path` — Absolute output path.<br>`fullPage` — Capture the full scrollable page.<br>`clip` — CSS-pixel clipping rectangle.<br>`raw` — Bypass device-pixel-ratio correction. | Capture this Page to a PNG file. || `await page.url()` | — | Read this Page's current URL. |+| `await page.waitForURL(urlOrRegExp, { timeout? })` | `timeout` — Maximum duration in milliseconds. | Wait for an exact URL or regular-expression match. || `await page.title()` | — | Read this Page's current title. || `await page.info()` | — | Read URL, title, viewport, scroll, and dialog state. || `await page.evaluate(fnOrString, argument?)` | — | Run JavaScript in this Page with JSON-serializable data. |