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
feat(ego-browser): add popup waiters
Aute2857d1c66a7b
diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/index.mjsindex 9d00218..0efeb38 100644--- a/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs+++ b/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs@@ -19,6 +19,7 @@ import { pageScrolledScreenshotCase } from "./page-screenshot.mjs";import { pageSnapshotLocatorCase } from "./page-snapshot-locators.mjs";import { pageShadowDomCase } from "./page-shadow-dom.mjs";import { pageTextLocatorCase } from "./page-text-locators.mjs";+import { pagePopupWaiterCase } from "./page-popup-waiter.mjs";import { pageOopifActionCase, pageOopifRestoreCase } from "./page-oopif.mjs";import { pageLoadStatesCase } from "./page-load-states.mjs";import {@@ -101,6 +102,7 @@ export const e2eCases = [{ name: "Page snapshot locator quality", body: pageSnapshotLocatorCase },{ name: "Page open Shadow DOM locators", body: pageShadowDomCase },{ name: "Page text locators", body: pageTextLocatorCase },+ { name: "Page popup waiter and URL diagnostic", body: pagePopupWaiterCase },{ name: "Page OOPIF actions", body: pageOopifActionCase },{ name: "Page OOPIF restore and close", body: pageOopifRestoreCase },{ name: "Page load states", body: pageLoadStatesCase },diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/page-popup-waiter.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/page-popup-waiter.mjsnew file mode 100644index 0000000..b2165a6--- /dev/null+++ b/package/ego-browser/scripts/real-browser-e2e/cases/page-popup-waiter.mjs@@ -0,0 +1,68 @@+export function pagePopupWaiterCase() {+ return `+ const task = await taskSpace(taskName);+ const source = await task.openPage(baseUrl + "/?page=popup-waiter", {+ as: "popup-waiter-source",+ });+ try {+ await source.evaluate((popupUrl) => {+ const button = document.createElement("button");+ button.id = "popup-waiter-button";+ button.textContent = "Open delayed popup";+ button.addEventListener("click", () => {+ setTimeout(() => window.open(popupUrl, "_blank"), 250);+ });+ document.body.append(button);+ }, baseUrl + "/secondary?popup-waiter=explicit");++ const pendingPopup = source.waitForEvent("popup", { timeout: 3_000 });+ const firstReceipt = await source.click("#popup-waiter-button");+ const firstPopup = await pendingPopup;+ assertEqual(+ firstReceipt.popups?.length ?? 0,+ 0,+ "the delayed popup opens after the action receipt window"+ );+ assertIncludes(+ await firstPopup.url(),+ "popup-waiter=explicit",+ "the explicit popup waiter returns a usable Page"+ );+ await firstPopup.close();++ await source.evaluate((popupUrl) => {+ const link = document.createElement("a");+ link.id = "popup-waiter-link";+ link.href = popupUrl;+ link.target = "_blank";+ link.textContent = "Open immediate popup";+ document.body.append(link);+ }, baseUrl + "/secondary?popup-waiter=wrong-page");+ const secondReceipt = await source.click("#popup-waiter-link");+ const startedAt = Date.now();+ let waitError;+ try {+ await source.waitForURL(/popup-waiter=wrong-page$/, { timeout: 15_000 });+ } catch (error) {+ waitError = error;+ }+ assertEqual(+ waitError?.code,+ "EGO_URL_OPENED_IN_POPUP",+ "waiting on the opener reports the popup instead of timing out"+ );+ assertIncludes(+ waitError?.message,+ 'task.page("' + secondReceipt.popups[0].label + '")',+ "the diagnostic gives the exact Page recovery expression"+ );+ assert(+ Date.now() - startedAt < 2_000,+ "the wrong-Page wait fails before the 15 second timeout"+ );+ await task.page(secondReceipt.popups[0].label).close();+ } finally {+ await source.close();+ }+ `;+}diff --git a/package/ego-browser/src/driver/page-waits.ts b/package/ego-browser/src/driver/page-waits.tsindex d5a373a..618f11f 100644--- a/package/ego-browser/src/driver/page-waits.ts+++ b/package/ego-browser/src/driver/page-waits.ts@@ -43,6 +43,10 @@ export type PageWaitForURLOptions = {timeout?: number;};+export type PageWaitForURLHooks = {+ interrupt?: (lastUrl: string) => Error | undefined;+};+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;}";@@ -123,6 +127,7 @@ export async function waitForURLInPage(sessionId: string,expected: string | RegExp,options: PageWaitForURLOptions = {},+ hooks: PageWaitForURLHooks = {},): Promise<void> {if (!(@@ -167,6 +172,8 @@ export async function waitForURLInPage(if (pattern!.test(lastUrl)) return;}}+ const interruption = hooks.interrupt?.(lastUrl);+ if (interruption) throw interruption;const waitMs = deadline - services.now();if (waitMs <= 0) break;await services.sleep(Math.min(100, waitMs));diff --git a/package/ego-browser/src/output-sink.test.mjs b/package/ego-browser/src/output-sink.test.mjsindex fa25cf9..39447cf 100644--- a/package/ego-browser/src/output-sink.test.mjs+++ b/package/ego-browser/src/output-sink.test.mjs@@ -4,11 +4,13 @@ import assert from "node:assert/strict";import {bufferOutput,flushSink,- markPageObserved,markHardStop,- recordUnhandledPage,resetSink,} from "../dist/src/output-sink.js";+import {+ markPageObserved,+ recordUnhandledPage,+} from "../dist/src/page-discovery.js";function fakeStream() {const chunks = [];diff --git a/package/ego-browser/src/output-sink.ts b/package/ego-browser/src/output-sink.tsindex 47471bf..babc245 100644--- a/package/ego-browser/src/output-sink.ts+++ b/package/ego-browser/src/output-sink.ts@@ -1,4 +1,9 @@import { formatCliLogValue } from "./format.js";+import {+ consumeUnhandledPageNotices,+ resetPageNotices,+ type UnhandledPageNotice,+} from "./page-discovery.js";/*** Round output stays buffered until completion because bytes written before a hard@@ -11,20 +16,10 @@ type WritableLike = { write(chunk: string): unknown };export type RoundConsole = Pick<Console, "log" | "info" | "warn" | "error">;-export type UnhandledPageNotice = {- spaceId: number;- targetId: string;- label: string;- openerLabel?: string;- url?: string;-};-let buffer: string[] = [];let hardStopMessage: string | null = null;let flushed = false;let lifecycleHooked = false;-const pendingPageNotices = new Map<string, UnhandledPageNotice>();-const observedPages = new Set<string>();/** Buffer one already-formatted cliLog chunk (the trailing newline is included). */export function bufferOutput(chunk: string): void {@@ -58,54 +53,6 @@ export function markHardStop(message: string): void {}}-/** Queue a discovered Page for the round summary unless agent code used it. */-export function recordUnhandledPage(notice: UnhandledPageNotice): void {- const key = pageKey(notice.spaceId, notice.targetId);- if (observedPages.has(key)) return;- pendingPageNotices.set(key, {- ...pendingPageNotices.get(key),- ...notice,- });-}--/** Mark a Page as used during this round so it needs no automatic summary. */-export function markPageObserved(spaceId: number, targetId: string): void {- const key = pageKey(spaceId, targetId);- observedPages.add(key);- pendingPageNotices.delete(key);-}--/** Remove round output state for a Page that no longer exists. */-export function forgetPageNotice(spaceId: number, targetId: string): void {- const key = pageKey(spaceId, targetId);- pendingPageNotices.delete(key);- observedPages.delete(key);-}--/** Remove pending Page output when its task space reaches a terminal state. */-export function clearSpacePageNotices(spaceId: number): void {- const prefix = `${spaceId}:`;- for (const key of pendingPageNotices.keys()) {- if (key.startsWith(prefix)) pendingPageNotices.delete(key);- }- for (const key of observedPages) {- if (key.startsWith(prefix)) observedPages.delete(key);- }-}--/** Drain Page notices once. Exported so behavior tests can inspect the round. */-export function consumeUnhandledPageNotices(): UnhandledPageNotice[] {- const notices = [...pendingPageNotices.values()];- pendingPageNotices.clear();- return notices;-}--/** Clear only Page notice state for Page-model behavior tests. */-export function resetPageNotices(): void {- pendingPageNotices.clear();- observedPages.clear();-}-/*** Emit the run's output exactly once.*@@ -159,10 +106,6 @@ function oneLine(value: string): string {return value.replace(/\s+/g, " ").trim();}-function pageKey(spaceId: number, targetId: string): string {- return `${spaceId}:${targetId}`;-}-/*** Flush on process teardown for the SDK path, where the host runs each heredoc directly* and never calls the CLI `execute()` wrapper, so lifecycle events are our only hook.diff --git a/package/ego-browser/src/page-discovery.ts b/package/ego-browser/src/page-discovery.tsnew file mode 100644index 0000000..fdd70bc--- /dev/null+++ b/package/ego-browser/src/page-discovery.ts@@ -0,0 +1,97 @@+/**+ * Round-local Page discovery shared by action receipts, popup waiters, URL+ * diagnostics, and the final unhandled-Page summary.+ */+export type UnhandledPageNotice = {+ spaceId: number;+ targetId: string;+ label: string;+ openerLabel?: string;+ url?: string;+};++type PageNoticeListener = (notice: UnhandledPageNotice) => void;++const pendingPageNotices = new Map<string, UnhandledPageNotice>();+const observedPages = new Set<string>();+const pageNoticeListeners = new Set<PageNoticeListener>();++/** Record or refresh one discovered Page that Agent code has not used yet. */+export function recordUnhandledPage(notice: UnhandledPageNotice): void {+ const key = pageKey(notice.spaceId, notice.targetId);+ if (observedPages.has(key)) return;+ const merged = {+ ...pendingPageNotices.get(key),+ ...notice,+ };+ pendingPageNotices.set(key, merged);+ for (const listener of [...pageNoticeListeners]) listener(merged);+}++/** Refresh the URL of an already-discovered Page without creating a new notice. */+export function refreshUnhandledPageNotice(+ spaceId: number,+ targetId: string,+ url: string,+): void {+ const key = pageKey(spaceId, targetId);+ const existing = pendingPageNotices.get(key);+ if (!existing) return;+ recordUnhandledPage({ ...existing, url });+}++/** Mark a Page as used during this round so it needs no further guidance. */+export function markPageObserved(spaceId: number, targetId: string): void {+ const key = pageKey(spaceId, targetId);+ observedPages.add(key);+ pendingPageNotices.delete(key);+}++/** Remove round state for a Page that no longer exists. */+export function forgetPageNotice(spaceId: number, targetId: string): void {+ const key = pageKey(spaceId, targetId);+ pendingPageNotices.delete(key);+ observedPages.delete(key);+}++/** Remove pending Page state when its task space reaches a terminal state. */+export function clearSpacePageNotices(spaceId: number): void {+ const prefix = `${spaceId}:`;+ for (const key of pendingPageNotices.keys()) {+ if (key.startsWith(prefix)) pendingPageNotices.delete(key);+ }+ for (const key of observedPages) {+ if (key.startsWith(prefix)) observedPages.delete(key);+ }+}++/** Read pending Page notices without consuming the round summary. */+export function peekUnhandledPageNotices(): UnhandledPageNotice[] {+ return [...pendingPageNotices.values()].map((notice) => ({ ...notice }));+}++/** Observe future Page discoveries. The caller owns the returned unsubscribe. */+export function subscribeUnhandledPageNotices(+ listener: PageNoticeListener,+): () => void {+ pageNoticeListeners.add(listener);+ return () => pageNoticeListeners.delete(listener);+}++/** Drain Page notices once when round output is flushed. */+export function consumeUnhandledPageNotices(): UnhandledPageNotice[] {+ const notices = peekUnhandledPageNotices();+ pendingPageNotices.clear();+ return notices;+}++/** Clear round state. Real runs get a new process; tests can reuse one process. */+export function resetPageNotices(): void {+ pendingPageNotices.clear();+ observedPages.clear();+ pageNoticeListeners.clear();+}++function pageKey(spaceId: number, targetId: string): string {+ return `${spaceId}:${targetId}`;+}diff --git a/package/ego-browser/src/page-model.test.mjs b/package/ego-browser/src/page-model.test.mjsindex b29dbe4..a0e1028 100644--- a/package/ego-browser/src/page-model.test.mjs+++ b/package/ego-browser/src/page-model.test.mjs@@ -15,7 +15,7 @@ import { PageRefRegistry } from "../dist/src/page-ref-registry.js";import {consumeUnhandledPageNotices,resetPageNotices,-} from "../dist/src/output-sink.js";+} from "../dist/src/page-discovery.js";async function withFixture(fn) {const rootDir = await mkdtemp(join(tmpdir(), "ego-page-model-test-"));@@ -2655,6 +2655,76 @@ test("Page waitForURL follows a popup from about:blank without activating it", a});});+test("Page.waitForEvent arms before a click and resolves the opened popup", async () => {+ await withFixture(async (fixture) => {+ resetPageNotices();+ const task = taskForRound(fixture, "round-a");+ const source = await task.openPage("https://example.test/source");+ fixture.openPopupOnNextClick("https://example.test/popup");++ const popupPromise = source.waitForEvent("popup", { timeout: 1_000 });+ const receipt = await source.click("#open-popup");+ const popup = await popupPromise;++ assert.equal(popup.label, receipt.popups[0].label);+ assert.equal(await popup.url(), "https://example.test/popup");+ assert.deepEqual(consumeUnhandledPageNotices(), []);+ });+});++test("Page.waitForEvent rejects unsupported events and times out cleanly", async () => {+ await withFixture(async (fixture) => {+ const task = taskForRound(fixture, "round-a");+ const source = await task.openPage("https://example.test/source");++ assert.throws(+ () => source.waitForEvent("download", { timeout: 10 }),+ /only supports the popup event/,+ );+ await assert.rejects(+ source.waitForEvent("popup", { timeout: 5 }),+ /page\.waitForEvent\("popup"\) timed out after 5ms/,+ );+ });+});++test("Page.waitForURL immediately reports a matching popup opened by this Page", async () => {+ await withFixture(async (fixture) => {+ resetPageNotices();+ const task = taskForRound(fixture, "round-a");+ const source = await task.openPage("https://example.test/source");+ fixture.openPopupOnNextClick("https://example.test/drive/home");+ await source.click("#open-popup");++ await assert.rejects(+ source.waitForURL(/\/drive\/home/, { timeout: 15_000 }),+ (error) => {+ assert.equal(error.code, "EGO_URL_OPENED_IN_POPUP");+ assert.match(error.message, /p1 did not navigate/);+ assert.match(error.message, /popup p2 opened/);+ assert.match(error.message, /task\.page\("p2"\)/);+ assert.match(error.message, /triggering action already succeeded/i);+ assert.doesNotMatch(error.message, /timed out/);+ return true;+ },+ );+ });+});++test("Page.waitForURL still succeeds when the opener itself reaches the URL", async () => {+ await withFixture(async (fixture) => {+ resetPageNotices();+ const task = taskForRound(fixture, "round-a");+ const source = await task.openPage("https://example.test/source");+ const expectedUrl = "https://example.test/drive/home";+ fixture.openPopupOnNextClick(expectedUrl);+ fixture.navigateOnNextClick(expectedUrl);+ await source.click("#open-popup");++ await source.waitForURL(/\/drive\/home/, { timeout: 500 });+ });+});+test("Page waitForURL validates its matcher and reports the last URL", 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 32ae081..b7d7093 100644--- a/package/ego-browser/src/page-model.ts+++ b/package/ego-browser/src/page-model.ts@@ -82,8 +82,12 @@ import {clearSpacePageNotices,forgetPageNotice,markPageObserved,+ peekUnhandledPageNotices,+ refreshUnhandledPageNotice,recordUnhandledPage,-} from "./output-sink.js";+ subscribeUnhandledPageNotices,+ type UnhandledPageNotice,+} from "./page-discovery.js";import { validatePublicApiOptions } from "./public-api-schema.js";import { parseRef, type RefMap } from "./ref-map.js";import { state } from "./state.js";@@ -146,6 +150,10 @@ type PageWaitForFileChooserOptions = {timeout?: number;};+type PageWaitForEventOptions = {+ timeout?: number;+};+export type PageFetchOptions = {timeout?: number;method?: string;@@ -1033,6 +1041,17 @@ class TaskSpace {}return;}+ if (event?.method === "Target.targetInfoChanged") {+ const info = event.params?.targetInfo;+ if (+ info?.type === "page" &&+ typeof info.targetId === "string" &&+ typeof info.url === "string"+ ) {+ refreshUnhandledPageNotice(this.id, info.targetId, info.url);+ }+ return;+ }const info = event?.params?.targetInfo;if (event?.method !== "Target.targetCreated" ||@@ -1185,6 +1204,7 @@ class Page {readonly spaceId: number;readonly mouse: PageMouse;readonly keyboard: PageKeyboard;+ readonly #task: TaskSpace;readonly #services: PageModelServices;readonly #spaceName: string;#targetId?: string;@@ -1199,6 +1219,7 @@ class Page {) {this.label = label;this.spaceId = task.id;+ this.#task = task;this.#spaceName = task.name;this.#services = services;this.#targetId = entry?.targetId;@@ -1282,10 +1303,65 @@ class Page {validatePublicApiOptions("Page.waitForURL", options);const page = await this.#resolve();return this.#services.gate.withPage(page, ({ sessionId }) =>- waitForURLInPage(this.#services, sessionId, expected, options),+ waitForURLInPage(this.#services, sessionId, expected, options, {+ interrupt: (lastUrl) =>+ matchingPopupWaitError(this.spaceId, this.label, lastUrl, expected),+ }),);}+ /** Wait for the next popup opened by this Page. */+ waitForEvent(+ event: "popup",+ options: PageWaitForEventOptions = {},+ ): Promise<Page> {+ if (event !== "popup") {+ throw new TypeError("page.waitForEvent only supports the popup event");+ }+ validatePublicApiOptions("Page.waitForEvent", options);+ const timeoutMs = options.timeout ?? 10_000;++ // Subscribe synchronously so the common `const pending = waitForEvent();+ // await click()` pattern cannot miss a popup created by the click.+ return new Promise<Page>((resolve, reject) => {+ let settled = false;+ let timer: ReturnType<typeof setTimeout> | undefined;+ const finish = (operation: () => void) => {+ if (settled) return;+ settled = true;+ unsubscribe();+ if (timer) clearTimeout(timer);+ operation();+ };+ const onNotice = (notice: UnhandledPageNotice) => {+ if (+ notice.spaceId !== this.spaceId ||+ notice.openerLabel !== this.label+ ) {+ return;+ }+ finish(() => {+ markPageObserved(notice.spaceId, notice.targetId);+ resolve(this.#task.page(notice.label));+ });+ };+ const unsubscribe = subscribeUnhandledPageNotices(onNotice);+ timer = setTimeout(() => {+ finish(() =>+ reject(+ new Error(+ `page.waitForEvent("popup") timed out after ${timeoutMs}ms`,+ ),+ ),+ );+ }, timeoutMs);++ // Resolve the source after arming the listener. A stale Page should fail+ // the waiter, but no popup may be lost while that validation is pending.+ void this.#resolve().catch((error) => finish(() => reject(error)));+ });+ }+/** Wait without activating this Page or occupying the native operation gate. */async waitForTimeout(timeout: number): Promise<void> {if (@@ -2290,6 +2366,38 @@ function unhandledFileChooserError(): Error & { code: string } {return error;}+function matchingPopupWaitError(+ spaceId: number,+ openerLabel: string,+ lastUrl: string,+ expected: string | RegExp,+): (Error & { code: string }) | undefined {+ const popup = peekUnhandledPageNotices().find(+ (notice) =>+ notice.spaceId === spaceId &&+ notice.openerLabel === openerLabel &&+ typeof notice.url === "string" &&+ urlMatches(notice.url, expected),+ );+ if (!popup) return undefined;++ const error = new Error(+ `page ${openerLabel} did not navigate from ${JSON.stringify(lastUrl)}, ` ++ `but popup ${popup.label} opened from it at ${JSON.stringify(popup.url)}. ` ++ `The triggering action already succeeded; do not repeat it. Continue with ` ++ `task.page(${JSON.stringify(popup.label)}).`,+ ) as Error & { code: string };+ error.code = "EGO_URL_OPENED_IN_POPUP";+ return error;+}++function urlMatches(url: string, expected: string | RegExp): boolean {+ if (typeof expected === "string") return url === expected;+ const pattern = new RegExp(expected.source, expected.flags);+ pattern.lastIndex = 0;+ return pattern.test(url);+}+function assertCdpCall(apiName: "Page.cdp" | "TaskSpace.cdp",method: string,diff --git a/package/ego-browser/src/public-api-schema.test.mjs b/package/ego-browser/src/public-api-schema.test.mjsindex 922358f..23bc473 100644--- a/package/ego-browser/src/public-api-schema.test.mjs+++ b/package/ego-browser/src/public-api-schema.test.mjs@@ -21,6 +21,7 @@ test("the public API schema contains the v2 entry points and object methods", ()"TaskSpace.openPage","Page.snapshot","Page.targetId",+ "Page.waitForEvent","Page.waitForURL","Page.waitForTimeout","Page.focus",@@ -88,6 +89,14 @@ test("the generated reference contains signatures and option descriptions", () =markdown,/`await page\.goto\(url, \{ referer\?, timeout\?, waitUntil\? \}\)`/,);+ assert.match(+ markdown,+ /`await page\.waitForEvent\("popup", \{ timeout\? \}\)`/,+ );+ assert.match(+ markdown,+ /const popupPromise = page\.waitForEvent\("popup"\); await page\.click\(selector\)/,+ );assert.match(markdown, /`as` — Permanent Page label\.<br>`timeout`/);assert.match(markdown, /Open and durably label a new Page/);assert.match(diff --git a/package/ego-browser/src/public-api-schema.ts b/package/ego-browser/src/public-api-schema.tsindex a80af46..5f33ba5 100644--- a/package/ego-browser/src/public-api-schema.ts+++ b/package/ego-browser/src/public-api-schema.ts@@ -248,6 +248,13 @@ export const PUBLIC_API_SCHEMA: readonly PublicApiEntry[] = [summary: "Wait for an exact URL or regular-expression match.",options: { timeout },},+ {+ name: "Page.waitForEvent",+ signature: 'await page.waitForEvent("popup", { timeout? })',+ summary:+ "Wait for this Page's next popup; call before the triggering action.",+ options: { timeout },+ },{name: "Page.waitForTimeout",signature: "await page.waitForTimeout(timeout)",@@ -579,6 +586,8 @@ export function publicApiMarkdown(): string {"Generated from `package/ego-browser/src/public-api-schema.ts`.","",'High-level Page actions return a receipt that may contain `popups` or a synchronous `dialog`. Handle a returned dialog with `page.cdp("Page.handleJavaScriptDialog", { accept: true })` or `{ accept: false }` before continuing; prompts may also include `promptText`.',+ "",+ 'For an explicit popup wait, arm it before the action: `const popupPromise = page.waitForEvent("popup"); await page.click(selector); const popup = await popupPromise;`. The default workflow can read `receipt.popups` instead.',];for (const [group, entries] of groups) {lines.push(diff --git a/skills/ego-browser/references/api.md b/skills/ego-browser/references/api.mdindex 7839825..8b4e5c2 100644--- a/skills/ego-browser/references/api.md+++ b/skills/ego-browser/references/api.md@@ -4,6 +4,8 @@ Generated from `package/ego-browser/src/public-api-schema.ts`.High-level Page actions return a receipt that may contain `popups` or a synchronous `dialog`. Handle a returned dialog with `page.cdp("Page.handleJavaScriptDialog", { accept: true })` or `{ accept: false }` before continuing; prompts may also include `promptText`.+For an explicit popup wait, arm it before the action: `const popupPromise = page.waitForEvent("popup"); await page.click(selector); const popup = await popupPromise;`. The default workflow can read `receipt.popups` instead.+## Entry points| API | Options | Purpose |@@ -48,6 +50,7 @@ High-level Page actions return a receipt that may contain `popups` or a synchron| `await page.screenshot({ path?, fullPage?, clip?, raw? })` | `path` — Output path; missing parent directories are created.<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.waitForEvent("popup", { timeout? })` | `timeout` — Maximum duration in milliseconds. | Wait for this Page's next popup; call before the triggering action. || `await page.waitForTimeout(timeout)` | — | Wait a fixed number of milliseconds without activating this Page. || `await page.title()` | — | Read this Page's current title. || `await page.info()` | — | Read URL, title, viewport, scroll, and dialog state. |