Skip to content

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.

feat(ego-browser): add labeled pointer feedback

JackWang59641ad13fe6
diff --git a/package/ego-browser/src/browser-runtime.test.mjs b/package/ego-browser/src/browser-runtime.test.mjs
index 8850890..57e990b 100644
--- a/package/ego-browser/src/browser-runtime.test.mjs
+++ b/package/ego-browser/src/browser-runtime.test.mjs
@@ -114,6 +114,16 @@ test("frame sessions follow one Page target and are invalidated with it", async
["frame-grandchild", "session:frame-grandchild"],
],
);
+ assert.deepEqual(
+ [...first.parentFrameIds],
+ [
+ ["same-process-frame", "page-main"],
+ ["frame-child", "same-process-frame"],
+ ["same-process-inside-child", "frame-child"],
+ ["frame-grandchild", "same-process-inside-child"],
+ ],
+ "frame sessions retain the ancestry needed to render an OOPIF cursor",
+ );
assert.equal(attachCounts.has("foreign-frame"), false);
invalidateSession("page-main");
diff --git a/package/ego-browser/src/browser-runtime.ts b/package/ego-browser/src/browser-runtime.ts
index 60409f7..32b0652 100644
--- a/package/ego-browser/src/browser-runtime.ts
+++ b/package/ego-browser/src/browser-runtime.ts
@@ -571,8 +571,8 @@ export async function ensureSession(
/**
* Attach sessions for every live OOPIF that belongs to one top-level Page.
* Standard CDP reports an iframe target's parent as a frame id. The frame tree
- * is therefore needed to skip same-process frames and recover the nearest
- * Page/OOPIF target ancestor without admitting unrelated iframe targets.
+ * and target metadata together recover the nearest Page/OOPIF target ancestor
+ * without admitting unrelated iframe targets.
*/
export async function ensureFrameSessions(
pageTargetId: string,
@@ -712,7 +712,9 @@ export async function ensureFrameSessions(
sessionByTarget.set(info.targetId, sessionId);
}
- const sessions = new Map<string, string>();
+ const sessions = new Map<string, string>() as Map<string, string> & {
+ parentFrameIds?: ReadonlyMap<string, string | undefined>;
+ };
const collectFrameSessions = (
tree: any,
inheritedSessionId: string,
@@ -732,6 +734,9 @@ export async function ensureFrameSessions(
sessions.set(info.targetId, sessionByTarget.get(info.targetId)!);
}
}
+ sessions.parentFrameIds = new Map(
+ [...sessions.keys()].map((frameId) => [frameId, parentFrameIdOf(frameId)]),
+ );
return sessions;
}
diff --git a/package/ego-browser/src/driver/page-actions.ts b/package/ego-browser/src/driver/page-actions.ts
index dd2ac64..4d1031c 100644
--- a/package/ego-browser/src/driver/page-actions.ts
+++ b/package/ego-browser/src/driver/page-actions.ts
@@ -20,6 +20,7 @@ type PageActionServices = {
timeoutMs?: number,
): Promise<any>;
showAgentMousePosition(x: number, y: number): Promise<void>;
+ showAgentTaskState(state: string): Promise<void>;
sleep(ms: number): Promise<void>;
platform?: string;
};
@@ -33,6 +34,7 @@ export type PageClickOptions = {
position?: { x: number; y: number };
force?: boolean;
timeout?: number;
+ label?: string;
};
export type PageFillOptions = {
@@ -178,6 +180,7 @@ export type PageHoverOptions = {
position?: { x: number; y: number };
force?: boolean;
timeout?: number;
+ label?: string;
};
export type PageDragAndDropOptions = {
@@ -186,12 +189,14 @@ export type PageDragAndDropOptions = {
targetPosition?: { x: number; y: number };
force?: boolean;
timeout?: number;
+ label?: string;
};
export type PageMouseClickOptions = {
button?: MouseButton;
clickCount?: number;
delay?: number;
+ label?: string;
};
export type PageMouseButtonOptions = {
@@ -201,6 +206,11 @@ export type PageMouseButtonOptions = {
export type PageMouseMoveOptions = {
steps?: number;
+ label?: string;
+};
+
+export type PageMouseWheelOptions = {
+ label?: string;
};
type MouseMoveState = PageMouseMoveOptions & {
@@ -254,18 +264,34 @@ export async function clickInPage(
"page.click",
options.force,
sessionId,
+ iframeSessions,
+ );
+ const cursorPoint = await cursorPointForElement(
+ services,
+ sessionId,
+ target.sessionId,
+ target.frameId,
+ point,
+ point.local,
+ iframeSessions,
);
const buttons = pressedButtons(button);
- await dispatchMouseEvent(services, target.sessionId, {
- type: "mouseMoved",
- x: point.x,
- y: point.y,
- button: "none",
- buttons: 0,
- modifiers,
- });
- if (target.frameId) {
- // Moving into an iframe can adjust the outer document's
+ showAgentActionLabel(services, options.label ?? "Clicking element");
+ await dispatchMouseEvent(
+ services,
+ target.sessionId,
+ {
+ type: "mouseMoved",
+ x: point.x,
+ y: point.y,
+ button: "none",
+ buttons: 0,
+ modifiers,
+ },
+ cursorPoint,
+ );
+ if (target.frameId && target.sessionId === sessionId) {
+ // Moving into a same-process iframe can adjust the outer document's
// scroll position. Translate the frame-local point again before the
// press so native input uses the post-hover viewport coordinates.
const pagePoint = await pagePointForFrame(
@@ -387,6 +413,7 @@ export async function fillInPage(
"page.fill",
true,
sessionId,
+ iframeSessions,
);
const preparationSource = `function fillPreparation(value, clearFirst) {
${ACTION_TARGET_STATE_HELPERS}
@@ -529,6 +556,7 @@ export async function fillInPage(
actionObjectId,
resolved.frameId,
sessionId,
+ iframeSessions,
);
result = await prepare();
if (typeof result?.error === "string") {
@@ -878,6 +906,7 @@ async function clickResolvedElement(
objectId: string,
frameId?: string,
pageSessionId = sessionId,
+ iframeSessions = new Map<string, string>(),
): Promise<void> {
const point = await resolveElementPoint(
services,
@@ -888,6 +917,7 @@ async function clickResolvedElement(
"page.fill",
false,
pageSessionId,
+ iframeSessions,
);
await assertElementReceivesPointerEvents(
services,
@@ -1011,7 +1041,9 @@ export async function hoverInPage(
"page.hover",
options.force,
sessionId,
+ iframeSessions,
);
+ showAgentActionLabel(services, options.label);
await dispatchMouseEvent(services, resolved.sessionId, {
type: "mouseMoved",
x: point.x,
@@ -1071,6 +1103,7 @@ export async function dragAndDropInPage(
"page.dragAndDrop",
options.force,
sessionId,
+ iframeSessions,
);
const targetPoint = await resolveElementPoint(
services,
@@ -1081,9 +1114,11 @@ export async function dragAndDropInPage(
"page.dragAndDrop",
options.force,
sessionId,
+ iframeSessions,
);
const button = options.button ?? "left";
const buttons = pressedButtons(button);
+ showAgentActionLabel(services, options.label);
await dispatchMouseEvent(services, source.sessionId, {
type: "mouseMoved",
x: sourcePoint.x,
@@ -1143,6 +1178,7 @@ export async function clickPointInPage(
const button = options.button ?? "left";
const clickCount = options.clickCount ?? 1;
const buttons = pressedButtons(button);
+ showAgentActionLabel(services, options.label);
await dispatchMouseEvent(services, sessionId, {
type: "mouseMoved",
x,
@@ -1188,6 +1224,7 @@ export async function moveMouseInPage(
): Promise<void> {
assertPoint(x, y, "page.mouse.move");
const steps = options.steps ?? 1;
+ showAgentActionLabel(services, options.label);
for (let step = 1; step <= steps; step += 1) {
await dispatchMouseEvent(services, sessionId, {
type: "mouseMoved",
@@ -1233,11 +1270,13 @@ export async function wheelInPage(
deltaX: number,
deltaY: number,
modifiers = 0,
+ options: PageMouseWheelOptions = {},
): Promise<void> {
assertPoint(x, y, "page.mouse.wheel");
if (!Number.isFinite(deltaX) || !Number.isFinite(deltaY)) {
throw new TypeError("page.mouse.wheel requires finite deltaX and deltaY");
}
+ showAgentActionLabel(services, options.label);
await dispatchWheelMotion(
{
dispatch: (params) => dispatchMouseEvent(services, sessionId, params),
@@ -1262,6 +1301,7 @@ async function resolveElementPoint(
actionName = "page.click",
force = false,
pageSessionId = sessionId,
+ iframeSessions = new Map<string, string>(),
): Promise<{ x: number; y: number; local: { x: number; y: number } }> {
if (
position !== undefined &&
@@ -1318,7 +1358,13 @@ async function resolveElementPoint(
return point;
}`;
if (frameId) {
- await ensureFrameOwnerInView(services, pageSessionId, frameId, actionName);
+ await ensureFrameOwnerInView(
+ services,
+ pageSessionId,
+ frameId,
+ actionName,
+ iframeSessions,
+ );
}
for (let attempt = 0; attempt <= AUTO_SCROLL_ATTEMPTS; attempt += 1) {
const response = await services.cdp(
@@ -1397,11 +1443,34 @@ async function ensureFrameOwnerInView(
pageSessionId: string,
frameId: string,
actionName: string,
+ iframeSessions: Map<string, string>,
+ visited = new Set<string>(),
): Promise<void> {
+ if (visited.has(frameId)) return;
+ visited.add(frameId);
+ const parentFrameIds = (
+ iframeSessions as Map<string, string> & {
+ parentFrameIds?: ReadonlyMap<string, string | undefined>;
+ }
+ ).parentFrameIds;
+ const parentFrameId = parentFrameIds?.get(frameId);
+ if (parentFrameId && iframeSessions.has(parentFrameId)) {
+ await ensureFrameOwnerInView(
+ services,
+ pageSessionId,
+ parentFrameId,
+ actionName,
+ iframeSessions,
+ visited,
+ );
+ }
+ const ownerSessionId = parentFrameId
+ ? iframeSessions.get(parentFrameId) || pageSessionId
+ : pageSessionId;
const owner = await services.cdp(
"DOM.getFrameOwner",
{ frameId },
- pageSessionId,
+ ownerSessionId,
);
const backendNodeId = owner?.backendNodeId;
if (backendNodeId === undefined || backendNodeId === null) {
@@ -1413,7 +1482,7 @@ async function ensureFrameOwnerInView(
const resolved = await services.cdp(
"DOM.resolveNode",
{ backendNodeId, objectGroup: "ego-browser" },
- pageSessionId,
+ ownerSessionId,
);
const objectId = resolved?.object?.objectId;
if (!objectId) {
@@ -1443,7 +1512,7 @@ async function ensureFrameOwnerInView(
returnByValue: true,
awaitPromise: false,
},
- pageSessionId,
+ ownerSessionId,
);
const result = runtimeValue(response, source);
if (typeof result?.error === "string") {
@@ -1469,14 +1538,14 @@ async function ensureFrameOwnerInView(
await dispatchWheelMotion(
{
dispatch: (params) =>
- dispatchMouseEvent(services, pageSessionId, params),
+ dispatchMouseEvent(services, ownerSessionId, params),
sleep: services.sleep,
},
scroll,
);
}
} finally {
- await releaseObject(services, pageSessionId, objectId);
+ await releaseObject(services, ownerSessionId, objectId);
}
}
@@ -1519,6 +1588,79 @@ async function pagePointForFrame(
return { x: point.x + content[0], y: point.y + content[1] };
}
+async function cursorPointForElement(
+ services: PageActionServices,
+ pageSessionId: string,
+ targetSessionId: string,
+ frameId: string | undefined,
+ inputPoint: { x: number; y: number },
+ localPoint: { x: number; y: number },
+ iframeSessions: Map<string, string>,
+): Promise<{ x: number; y: number }> {
+ if (!frameId || targetSessionId === pageSessionId) return inputPoint;
+ const parents = new Map<string, string | undefined>(
+ (
+ iframeSessions as Map<string, string> & {
+ parentFrameIds?: ReadonlyMap<string, string | undefined>;
+ }
+ ).parentFrameIds,
+ );
+ try {
+ const response = await services.cdp("Page.getFrameTree", {}, pageSessionId);
+ const collect = (tree: any, parentId: string | undefined) => {
+ const currentFrameId = tree?.frame?.id;
+ if (typeof currentFrameId !== "string") return;
+ parents.set(currentFrameId, tree.frame.parentId ?? parentId);
+ for (const child of tree.childFrames || []) {
+ collect(child, currentFrameId);
+ }
+ };
+ collect(response?.frameTree, undefined);
+ } catch {
+ // OOPIF ancestry from Target.getTargets remains usable when FrameTree is
+ // unavailable or omits cross-process descendants.
+ }
+
+ try {
+ let point = localPoint;
+ let currentFrameId: string | undefined = frameId;
+ let currentSessionId = targetSessionId;
+ const visited = new Set<string>();
+ while (
+ currentFrameId &&
+ parents.get(currentFrameId) &&
+ !visited.has(currentFrameId)
+ ) {
+ visited.add(currentFrameId);
+ let boundaryFrameId = currentFrameId;
+ let parentFrameId = parents.get(boundaryFrameId);
+ while (
+ parentFrameId &&
+ parents.get(parentFrameId) &&
+ (iframeSessions.get(parentFrameId) || pageSessionId) ===
+ currentSessionId
+ ) {
+ boundaryFrameId = parentFrameId;
+ parentFrameId = parents.get(boundaryFrameId);
+ }
+ const parentSessionId = parentFrameId
+ ? iframeSessions.get(parentFrameId) || pageSessionId
+ : pageSessionId;
+ point = (await pagePointForFrame(
+ services,
+ parentSessionId,
+ boundaryFrameId,
+ point,
+ ))!;
+ currentFrameId = parentFrameId;
+ currentSessionId = parentSessionId;
+ }
+ return point;
+ } catch {
+ return inputPoint;
+ }
+}
+
async function assertElementReceivesPointerEvents(
services: PageActionServices,
sessionId: string,
@@ -1623,6 +1765,7 @@ async function dispatchMouseEvent(
services: PageActionServices,
sessionId: string,
params: Record<string, unknown>,
+ cursorPoint?: { x: number; y: number },
): Promise<void> {
await services.cdp("Input.dispatchMouseEvent", params, sessionId);
if (
@@ -1632,7 +1775,7 @@ async function dispatchMouseEvent(
) {
return;
}
- showAgentCursor(services, { x: params.x, y: params.y });
+ showAgentCursor(services, cursorPoint || { x: params.x, y: params.y });
}
function showAgentCursor(
@@ -1659,6 +1802,20 @@ function showAgentCursor(
}
}
+function showAgentActionLabel(
+ services: PageActionServices,
+ label: string | undefined,
+): void {
+ if (!label) return;
+ try {
+ // Labels are display-only, like the native cursor. Start the update before
+ // the pointer event but never let a rendering problem block the action.
+ void services.showAgentTaskState(label).catch(() => {});
+ } catch {
+ // Also tolerate an invalid adapter that throws before returning a Promise.
+ }
+}
+
async function releaseObject(
services: PageActionServices,
sessionId: string,
diff --git a/package/ego-browser/src/helpers.test.mjs b/package/ego-browser/src/helpers.test.mjs
index bd77ea8..792e46e 100644
--- a/package/ego-browser/src/helpers.test.mjs
+++ b/package/ego-browser/src/helpers.test.mjs
@@ -170,6 +170,7 @@ test("profiles rejects malformed native results", async () => {
test("taskspace helper surface exposes public helpers including claimTaskSpace", () => {
const context = helperContext();
+ assert.equal(context.showTaskState, undefined);
assert.equal(typeof context.taskSpace, "function");
assert.equal(typeof context.profiles, "function");
assert.equal(typeof context.listTaskSpaces, "function");
diff --git a/package/ego-browser/src/page-actions.test.mjs b/package/ego-browser/src/page-actions.test.mjs
index 94a201f..84e5278 100644
--- a/package/ego-browser/src/page-actions.test.mjs
+++ b/package/ego-browser/src/page-actions.test.mjs
@@ -6,6 +6,7 @@ import { RefMap } from "../dist/src/ref-map.js";
test("Page click translates same-process iframe coordinates to the Page viewport", async () => {
const calls = [];
+ const states = [];
const services = {
async cdp(method, params = {}, sessionId) {
calls.push([method, params, sessionId]);
@@ -48,6 +49,9 @@ test("Page click translates same-process iframe coordinates to the Page viewport
return {};
},
async showAgentMousePosition() {},
+ async showAgentTaskState(state) {
+ states.push(state);
+ },
async sleep() {},
};
@@ -98,4 +102,193 @@ test("Page click translates same-process iframe coordinates to the Page viewport
false,
"same-process iframe input keeps mouseMoved and mousePressed contiguous",
);
+ assert.deepEqual(states, ["Clicking element"]);
+});
+
+test("Page click keeps raw-selector OOPIF input local but renders its cursor in the Page viewport", async () => {
+ const calls = [];
+ const cursorPoints = [];
+ const services = {
+ async cdp(method, params = {}, sessionId) {
+ calls.push([method, params, sessionId]);
+ if (method === "Accessibility.getFullAXTree") {
+ return sessionId === "session:frame"
+ ? {
+ nodes: [
+ {
+ role: { value: "button" },
+ name: { value: "Run OOPIF action" },
+ backendDOMNodeId: 21,
+ },
+ ],
+ }
+ : { nodes: [] };
+ }
+ if (method === "Runtime.evaluate") {
+ if (params.returnByValue === false) {
+ return sessionId === "session:frame"
+ ? { result: { objectId: "iframe-button" } }
+ : { result: {} };
+ }
+ return {
+ result: {
+ value: sessionId === "session:frame" ? 1 : 0,
+ },
+ };
+ }
+ if (method === "DOM.resolveNode") {
+ return { object: { objectId: "iframe-button" } };
+ }
+ if (method === "Runtime.callFunctionOn") {
+ if (params.functionDeclaration.includes("actionable: false")) {
+ return { result: { value: { actionable: true } } };
+ }
+ return params.functionDeclaration.includes("getBoundingClientRect")
+ ? { result: { value: { x: 10, y: 20 } } }
+ : { result: { value: { ok: true } } };
+ }
+ if (method === "Page.getFrameTree") {
+ return {
+ frameTree: {
+ frame: { id: "frame-page" },
+ childFrames: [{ frame: { id: "frame-child" } }],
+ },
+ };
+ }
+ if (method === "DOM.getFrameOwner") {
+ assert.equal(sessionId, "session:page");
+ assert.equal(params.frameId, "frame-child");
+ return { backendNodeId: 90 };
+ }
+ if (method === "DOM.getBoxModel") {
+ assert.equal(sessionId, "session:page");
+ return {
+ model: { content: [100, 200, 300, 200, 300, 400, 100, 400] },
+ };
+ }
+ return {};
+ },
+ async showAgentMousePosition(x, y) {
+ cursorPoints.push({ x, y });
+ },
+ async showAgentTaskState() {},
+ async sleep() {},
+ };
+
+ await clickInPage(
+ services,
+ "session:page",
+ new RefMap(),
+ "#iframe-button",
+ {},
+ 0,
+ new Map([["frame-child", "session:frame"]]),
+ );
+
+ const pointerEvents = calls
+ .filter(([method]) => method === "Input.dispatchMouseEvent")
+ .map(([, params, sessionId]) => ({ params, sessionId }));
+ assert(
+ pointerEvents.every(
+ ({ params, sessionId }) =>
+ sessionId === "session:frame" && params.x === 10 && params.y === 20,
+ ),
+ "OOPIF input stays in the child target's local viewport",
+ );
+ assert.deepEqual(cursorPoints, [{ x: 110, y: 220 }]);
+});
+
+test("Page click renders an OOPIF cursor when FrameTree omits its ancestor iframe", async () => {
+ const calls = [];
+ const cursorPoints = [];
+ const services = {
+ async cdp(method, params = {}, sessionId) {
+ calls.push([method, params, sessionId]);
+ if (method === "Accessibility.getFullAXTree") {
+ return sessionId === "session:map"
+ ? {
+ nodes: [
+ {
+ role: { value: "button" },
+ name: { value: "Run nested OOPIF action" },
+ backendDOMNodeId: 21,
+ },
+ ],
+ }
+ : { nodes: [] };
+ }
+ if (method === "DOM.resolveNode") {
+ return { object: { objectId: "iframe-button" } };
+ }
+ if (method === "Runtime.callFunctionOn") {
+ if (params.functionDeclaration.includes("actionable: false")) {
+ return { result: { value: { actionable: true } } };
+ }
+ return params.functionDeclaration.includes("getBoundingClientRect")
+ ? { result: { value: { x: 10, y: 20 } } }
+ : { result: { value: { ok: true } } };
+ }
+ if (method === "Page.getFrameTree") {
+ return {
+ frameTree: {
+ frame: { id: "frame-page" },
+ },
+ };
+ }
+ if (method === "DOM.getFrameOwner") {
+ if (params.frameId === "frame-map") {
+ assert.equal(sessionId, "session:runner");
+ return { backendNodeId: 90 };
+ }
+ if (params.frameId === "frame-demo") {
+ assert.equal(sessionId, "session:page");
+ return { backendNodeId: 91 };
+ }
+ throw new Error(`unexpected frame owner ${params.frameId}`);
+ }
+ if (method === "DOM.getBoxModel") {
+ const [x, y] = params.backendNodeId === 90 ? [100, 200] : [300, 400];
+ return {
+ model: { content: [x, y, x + 200, y, x + 200, y + 200, x, y + 200] },
+ };
+ }
+ return {};
+ },
+ async showAgentMousePosition(x, y) {
+ cursorPoints.push({ x, y });
+ },
+ async showAgentTaskState() {},
+ async sleep() {},
+ };
+
+ const iframeSessions = new Map([
+ ["frame-demo", "session:runner"],
+ ["frame-map", "session:map"],
+ ]);
+ iframeSessions.parentFrameIds = new Map([
+ ["frame-demo", "frame-page"],
+ ["frame-map", "frame-demo"],
+ ]);
+
+ await clickInPage(
+ services,
+ "session:page",
+ new RefMap(),
+ 'loc=role:button[name="Run nested OOPIF action"]',
+ {},
+ 0,
+ iframeSessions,
+ );
+
+ const pointerEvents = calls
+ .filter(([method]) => method === "Input.dispatchMouseEvent")
+ .map(([, params, sessionId]) => ({ params, sessionId }));
+ assert(
+ pointerEvents.every(
+ ({ params, sessionId }) =>
+ sessionId === "session:map" && params.x === 10 && params.y === 20,
+ ),
+ "OOPIF input stays in the child target's local viewport",
+ );
+ assert.deepEqual(cursorPoints, [{ x: 410, y: 620 }]);
});
diff --git a/package/ego-browser/src/page-model.ts b/package/ego-browser/src/page-model.ts
index f3b2f70..9907ba1 100644
--- a/package/ego-browser/src/page-model.ts
+++ b/package/ego-browser/src/page-model.ts
@@ -49,6 +49,7 @@ import {
type PageMouseButtonOptions,
type PageMouseClickOptions,
type PageMouseMoveOptions,
+ type PageMouseWheelOptions,
type PageSelectOption,
} from "./driver/page-actions.js";
import {
@@ -291,6 +292,7 @@ type PageModelServices = {
timeoutMs?: number,
): Promise<any>;
showAgentMousePosition(x: number, y: number): Promise<void>;
+ showAgentTaskState(state: string): Promise<void>;
withTemporaryClipboardText<T>(
content: PageClipboardContent,
action: () => Promise<T>,
@@ -498,7 +500,12 @@ class PageMouse {
this.#lastButton = "none";
}
- async wheel(deltaX: number, deltaY: number): Promise<void> {
+ async wheel(
+ deltaX: number,
+ deltaY: number,
+ options: PageMouseWheelOptions = {},
+ ): Promise<void> {
+ validatePublicApiOptions("Page.mouse.wheel", options);
return this.#run((services, sessionId) =>
wheelInPage(
services,
@@ -508,6 +515,7 @@ class PageMouse {
deltaX,
deltaY,
this.#modifierMask(),
+ options,
),
);
}
@@ -660,6 +668,11 @@ const baseDefaultServices: Omit<PageModelServices, "ledger" | "pageBudget"> = {
ego.animationHighlightMouseToPosition(x, y),
);
},
+ async showAgentTaskState(state) {
+ const ego = browserEgo();
+ if (typeof ego.setAgentTaskState !== "function") return;
+ await invokeEgo("page.mouse.label", () => ego.setAgentTaskState(state));
+ },
withTemporaryClipboardText,
snapshot: snapshotRaw,
screenshot: captureScreenshotForSession,
diff --git a/package/ego-browser/src/public-api-schema.test.mjs b/package/ego-browser/src/public-api-schema.test.mjs
index f4e5d06..722b4b5 100644
--- a/package/ego-browser/src/public-api-schema.test.mjs
+++ b/package/ego-browser/src/public-api-schema.test.mjs
@@ -38,6 +38,7 @@ test("the public API schema contains the v2 entry points and object methods", ()
]) {
assert(names.has(name), `missing public API schema entry: ${name}`);
}
+ assert.equal(names.has("showTaskState"), false);
assert.equal(names.has("TaskSpace.listPages"), false);
assert.equal(names.has("TaskSpace.close"), false);
assert.equal(names.has("Page.scrollBy"), false);
@@ -51,6 +52,10 @@ test("schema-driven option validation rejects unknown and invalid fields", () =>
delay: 0,
force: true,
timeout: 500,
+ label: "open account settings",
+ });
+ validatePublicApiOptions("Page.mouse.wheel", {
+ label: "scroll project board",
});
validatePublicApiOptions("Page.fetch", { saveAs: "/tmp/image.png" });
validatePublicApiOptions("Page.screenshot", {
@@ -78,7 +83,7 @@ test("schema-driven option validation rejects unknown and invalid fields", () =>
);
assert.throws(
() => validatePublicApiOptions("Page.click", { trial: true }),
- /unknown option: trial\. Expected: await page\.click\(selector, \{ button\?, clickCount\?, delay\?, position\?, force\?, timeout\? \}\)/,
+ /unknown option: trial\. Expected: await page\.click\(selector, \{ button\?, clickCount\?, delay\?, position\?, force\?, timeout\?, label\? \}\)/,
);
assert.throws(
() => validatePublicApiOptions("Page.screenshot", { scale: "invalid" }),
@@ -117,6 +122,12 @@ test("schema-driven option validation rejects unknown and invalid fields", () =>
test("the generated reference contains signatures and option descriptions", () => {
const markdown = publicApiMarkdown();
assert.match(markdown, /`await profiles\(\)`/);
+ assert.doesNotMatch(markdown, /`await showTaskState\(state\)`/);
+ assert.match(
+ markdown,
+ /`await page\.click\(selector, \{ button\?, clickCount\?, delay\?, position\?, force\?, timeout\?, label\? \}\)`/,
+ );
+ assert.match(markdown, /`label`.*user-visible action description/);
assert.match(markdown, /`await listTaskSpaces\(\)`/);
assert.match(markdown, /`await taskSpace\(nameOrId, \{ profileId\? \}\)`/);
assert.match(markdown, /a new space starts with managed Page p1/);
diff --git a/package/ego-browser/src/public-api-schema.ts b/package/ego-browser/src/public-api-schema.ts
index a09faf2..481e6c9 100644
--- a/package/ego-browser/src/public-api-schema.ts
+++ b/package/ego-browser/src/public-api-schema.ts
@@ -45,6 +45,10 @@ const position = option(
"CSS-pixel offset from the element's top-left corner.",
);
const force = option("boolean", "Bypass pointer interception checks.");
+const label = option(
+ "nonEmptyString",
+ "Concise user-visible action description shown with the native mouse highlight.",
+);
/**
* Single source of truth for the v2 surface shown to Agents. Runtime option
@@ -411,7 +415,7 @@ export const PUBLIC_API_SCHEMA: readonly PublicApiEntry[] = [
{
name: "Page.click",
signature:
- "await page.click(selector, { button?, clickCount?, delay?, position?, force?, timeout? })",
+ "await page.click(selector, { button?, clickCount?, delay?, position?, force?, timeout?, label? })",
summary: "Click an element with native CDP input.",
options: {
button,
@@ -420,25 +424,27 @@ export const PUBLIC_API_SCHEMA: readonly PublicApiEntry[] = [
position,
force,
timeout: actionTimeout,
+ label,
},
},
{
name: "Page.dblclick",
signature:
- "await page.dblclick(selector, { button?, delay?, position?, force?, timeout? })",
+ "await page.dblclick(selector, { button?, delay?, position?, force?, timeout?, label? })",
summary: "Double-click an element with native CDP input.",
- options: { button, delay, position, force, timeout: actionTimeout },
+ options: { button, delay, position, force, timeout: actionTimeout, label },
},
{
name: "Page.hover",
- signature: "await page.hover(selector, { position?, force?, timeout? })",
+ signature:
+ "await page.hover(selector, { position?, force?, timeout?, label? })",
summary: "Move the mouse over an element.",
- options: { position, force, timeout: actionTimeout },
+ options: { position, force, timeout: actionTimeout, label },
},
{
name: "Page.dragAndDrop",
signature:
- "await page.dragAndDrop(source, target, { button?, sourcePosition?, targetPosition?, force?, timeout? })",
+ "await page.dragAndDrop(source, target, { button?, sourcePosition?, targetPosition?, force?, timeout?, label? })",
summary: "Drag from one element to another.",
options: {
button,
@@ -446,6 +452,7 @@ export const PUBLIC_API_SCHEMA: readonly PublicApiEntry[] = [
targetPosition: position,
force,
timeout: actionTimeout,
+ label,
},
},
{
@@ -508,19 +515,24 @@ export const PUBLIC_API_SCHEMA: readonly PublicApiEntry[] = [
},
{
name: "Page.mouse.click",
- signature: "await page.mouse.click(x, y, { button?, clickCount?, delay? })",
+ signature:
+ "await page.mouse.click(x, y, { button?, clickCount?, delay?, label? })",
summary: "Click CSS-pixel coordinates with native CDP input.",
options: {
button,
clickCount: option("positiveInteger", "Number of clicks."),
delay,
+ label,
},
},
{
name: "Page.mouse.move",
- signature: "await page.mouse.move(x, y, { steps? })",
+ signature: "await page.mouse.move(x, y, { steps?, label? })",
summary: "Move the mouse to CSS-pixel coordinates.",
- options: { steps: option("positiveInteger", "Number of movement steps.") },
+ options: {
+ steps: option("positiveInteger", "Number of movement steps."),
+ label,
+ },
},
{
name: "Page.mouse.down",
@@ -548,9 +560,10 @@ export const PUBLIC_API_SCHEMA: readonly PublicApiEntry[] = [
},
{
name: "Page.mouse.wheel",
- signature: "await page.mouse.wheel(deltaX, deltaY)",
+ signature: "await page.mouse.wheel(deltaX, deltaY, { label? })",
summary:
"Perform a short wheel-input motion at the current Page position; move or click over the intended scroll container first in each process.",
+ options: { label },
},
{
name: "Page.keyboard.down",
diff --git a/skills/ego-browser/SKILL.md b/skills/ego-browser/SKILL.md
index aaf4f24..103ef50 100644
--- a/skills/ego-browser/SKILL.md
+++ b/skills/ego-browser/SKILL.md
@@ -43,6 +43,10 @@ infer Playwright methods such as `locator()`, `getByRole()`, `context()`,
the documented `page.evaluate()` or `page.cdp()` escape hatches instead of
guessing another method.
+Pointer actions accept an optional `label` with a concise 3-6 word description.
+Pass it with clicks, hovers, drags, or scrolling to keep the action text next to
+the visible agent cursor in sync with the action.
+
When the user explicitly asks for ego-browser, start with a real browser command
and diagnose the CLI or installation only if it fails.
@@ -233,8 +237,8 @@ spreadsheets, maps, and other interfaces that lack useful DOM semantics:
```js
const path = await page.screenshot({ path: "/absolute/path/before.png" });
-await page.mouse.click(420, 260);
-await page.mouse.wheel(0, 600);
+await page.mouse.click(420, 260, { label: "open spreadsheet cell" });
+await page.mouse.wheel(0, 600, { label: "scroll project board" });
await page.keyboard.paste("hello\tworld");
console.log({ screenshot: path });
```
diff --git a/skills/ego-browser/references/api.md b/skills/ego-browser/references/api.md
index 3157370..82951e1 100644
--- a/skills/ego-browser/references/api.md
+++ b/skills/ego-browser/references/api.md
@@ -41,52 +41,52 @@ Selectors accept refs, Ego locators, XPath, and raw CSS. A small compatibility s
## Page
-| API | Options | Purpose |
-| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `page.label` | — | Durable Page label used to restore the tab across rounds. |
-| `page.spaceId` | — | Numeric identifier of the Page's task space. |
-| `page.openedBy` | — | Conservative origin attribution for this Page. |
-| `page.targetId` | — | Internal browser target identifier for advanced Target-domain CDP only. |
-| `await page.goto(url, { referer?, timeout?, waitUntil? })` | `referer` — HTTP Referer header for the navigation.<br>`timeout` — Maximum duration in milliseconds.<br>`waitUntil` (commit, domcontentloaded, load, networkidle) — Completion state; defaults to load. networkidle requires 500ms without network activity. | Navigate this Page in place. Timeout errors report whether the new document committed, plus its URL and readyState when available. |
-| `await page.reload({ timeout?, waitUntil? })` | `timeout` — Maximum duration in milliseconds.<br>`waitUntil` (commit, domcontentloaded, load, networkidle) — Completion state; defaults to load. networkidle requires 500ms without network activity. | Reload this Page and wait for the selected navigation state. |
-| `await page.snapshot({ scope?, includeActionMarks?, includeStableLocator? })` | `scope` (full_page, only_within_viewport) — Snapshot scope; defaults to only_within_viewport.<br>`includeActionMarks` — Include action marks.<br>`includeStableLocator` — Include stable locators. | Return a semantic snapshot of the current viewport with Page provenance. |
-| `await page.screenshot({ path?, fullPage?, clip?, scale?, raw? })` | `path` — Output path; missing parent directories are created.<br>`fullPage` — Capture the full scrollable page.<br>`clip` — CSS-pixel clipping rectangle.<br>`scale` (css) — Output scale mode; css uses CSS-pixel sizing and is the default.<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. |
-| `await page.acceptDialog(promptText?)` | — | Accept this Page's JavaScript dialog, optionally supplying prompt text; return false when none is open. |
-| `await page.dismissDialog()` | — | Dismiss this Page's JavaScript dialog; return false when none is open. |
-| `await page.evaluate(fnOrString, argument?)` | — | Run JavaScript in this Page; callbacks receive JSON data but cannot capture Node.js variables. Safety-timeout errors report executionStopped, pageResponsive, and mayHaveLateEffects. |
-| `await page.waitForFunction(fnOrString, argument?, { timeout?, polling? })` | `timeout` — Maximum duration in milliseconds.<br>`polling` — Polling interval in milliseconds; defaults to 100. | Wait until a Page function or expression returns a truthy value. |
-| `await page.fetch(url, options?)` | `timeout` — Maximum duration in milliseconds.<br>`saveAs` — Write the response body to this path without text conversion.<br>`method` — HTTP method.<br>`headers` — Request headers.<br>`body` — Request body.<br>`cache` (default, no-store, reload, no-cache, force-cache, only-if-cached) — Fetch cache mode.<br>`credentials` (omit, same-origin, include) — Fetch credentials mode.<br>`integrity` — Subresource integrity value.<br>`keepalive` — Allow the request to outlive the page.<br>`mode` (cors, no-cors, same-origin) — Fetch request mode.<br>`redirect` (follow, error, manual) — Redirect handling mode.<br>`referrer` — Request referrer.<br>`referrerPolicy` — Request referrer policy. | Run window.fetch in this Page, obey browser CORS, and return a structured response. |
-| `await page.cdp(method, params?, { timeout? })` | `timeout` — Maximum duration in milliseconds. | Send a CDP command through this Page's target session. |
-| `await page.waitForSelector(selector, { timeout?, state? })` | `timeout` — Maximum duration in milliseconds.<br>`state` (attached, detached, visible, hidden) — Required element state. | Wait for an element state in this Page. |
-| `await page.waitForLoadState(state?, { timeout?, idleMs? })` | `timeout` — Maximum duration in milliseconds.<br>`idleMs` — Required network-idle window in milliseconds. | Wait for DOM content, load, or network-idle state; no state defaults to load. |
-| `await page.events()` | — | Read and clear CDP events buffered for this Page. |
-| `await page.click(selector, { button?, clickCount?, delay?, position?, force?, timeout? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Number of clicks.<br>`delay` — Input delay in milliseconds.<br>`position` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Click an element with native CDP input. |
-| `await page.dblclick(selector, { button?, delay?, position?, force?, timeout? })` | `button` (left, middle, right) — Mouse button.<br>`delay` — Input delay in milliseconds.<br>`position` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Double-click an element with native CDP input. |
-| `await page.hover(selector, { position?, force?, timeout? })` | `position` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Move the mouse over an element. |
-| `await page.dragAndDrop(source, target, { button?, sourcePosition?, targetPosition?, force?, timeout? })` | `button` (left, middle, right) — Mouse button.<br>`sourcePosition` — CSS-pixel offset from the element's top-left corner.<br>`targetPosition` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Drag from one element to another. |
-| `await page.fill(selector, value, { clearFirst?, timeout? })` | `clearFirst` — Clear the current value before filling.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Fill the selected field, its editing host, or its unique fillable descendant, then confirm editing took effect. |
-| `await page.selectOption(selector, valueOrValues, { timeout? })` | `timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Select by a value-or-label string or { value?, label?, index? }; arrays select multiple options, while null or [] clears the selection. The select must be enabled, but disabled options remain programmatically selectable. |
-| `await page.focus(selector, { timeout? })` | `timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Focus the element, its nearest interactive ancestor, or its unique editable descendant. |
-| `await page.press(selector, chord, { delay?, timeout? })` | `delay` — Input delay in milliseconds.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Focus one element and press a key or shortcut chord. |
-| `await page.setInputFiles(selector, pathOrPaths)` | — | Set files on a file input resolved from the input, its label, or a unique descendant. |
-| `page.waitForFileChooser({ timeout? })` | `timeout` — Maximum duration in milliseconds. | Wait for a dynamically created file chooser. |
-| `await page.close()` | — | Close this Page after confirming its tab disappeared. |
+| API | Options | Purpose |
+| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `page.label` | — | Durable Page label used to restore the tab across rounds. |
+| `page.spaceId` | — | Numeric identifier of the Page's task space. |
+| `page.openedBy` | — | Conservative origin attribution for this Page. |
+| `page.targetId` | — | Internal browser target identifier for advanced Target-domain CDP only. |
+| `await page.goto(url, { referer?, timeout?, waitUntil? })` | `referer` — HTTP Referer header for the navigation.<br>`timeout` — Maximum duration in milliseconds.<br>`waitUntil` (commit, domcontentloaded, load, networkidle) — Completion state; defaults to load. networkidle requires 500ms without network activity. | Navigate this Page in place. Timeout errors report whether the new document committed, plus its URL and readyState when available. |
+| `await page.reload({ timeout?, waitUntil? })` | `timeout` — Maximum duration in milliseconds.<br>`waitUntil` (commit, domcontentloaded, load, networkidle) — Completion state; defaults to load. networkidle requires 500ms without network activity. | Reload this Page and wait for the selected navigation state. |
+| `await page.snapshot({ scope?, includeActionMarks?, includeStableLocator? })` | `scope` (full_page, only_within_viewport) — Snapshot scope; defaults to only_within_viewport.<br>`includeActionMarks` — Include action marks.<br>`includeStableLocator` — Include stable locators. | Return a semantic snapshot of the current viewport with Page provenance. |
+| `await page.screenshot({ path?, fullPage?, clip?, scale?, raw? })` | `path` — Output path; missing parent directories are created.<br>`fullPage` — Capture the full scrollable page.<br>`clip` — CSS-pixel clipping rectangle.<br>`scale` (css) — Output scale mode; css uses CSS-pixel sizing and is the default.<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. |
+| `await page.acceptDialog(promptText?)` | — | Accept this Page's JavaScript dialog, optionally supplying prompt text; return false when none is open. |
+| `await page.dismissDialog()` | — | Dismiss this Page's JavaScript dialog; return false when none is open. |
+| `await page.evaluate(fnOrString, argument?)` | — | Run JavaScript in this Page; callbacks receive JSON data but cannot capture Node.js variables. Safety-timeout errors report executionStopped, pageResponsive, and mayHaveLateEffects. |
+| `await page.waitForFunction(fnOrString, argument?, { timeout?, polling? })` | `timeout` — Maximum duration in milliseconds.<br>`polling` — Polling interval in milliseconds; defaults to 100. | Wait until a Page function or expression returns a truthy value. |
+| `await page.fetch(url, options?)` | `timeout` — Maximum duration in milliseconds.<br>`saveAs` — Write the response body to this path without text conversion.<br>`method` — HTTP method.<br>`headers` — Request headers.<br>`body` — Request body.<br>`cache` (default, no-store, reload, no-cache, force-cache, only-if-cached) — Fetch cache mode.<br>`credentials` (omit, same-origin, include) — Fetch credentials mode.<br>`integrity` — Subresource integrity value.<br>`keepalive` — Allow the request to outlive the page.<br>`mode` (cors, no-cors, same-origin) — Fetch request mode.<br>`redirect` (follow, error, manual) — Redirect handling mode.<br>`referrer` — Request referrer.<br>`referrerPolicy` — Request referrer policy. | Run window.fetch in this Page, obey browser CORS, and return a structured response. |
+| `await page.cdp(method, params?, { timeout? })` | `timeout` — Maximum duration in milliseconds. | Send a CDP command through this Page's target session. |
+| `await page.waitForSelector(selector, { timeout?, state? })` | `timeout` — Maximum duration in milliseconds.<br>`state` (attached, detached, visible, hidden) — Required element state. | Wait for an element state in this Page. |
+| `await page.waitForLoadState(state?, { timeout?, idleMs? })` | `timeout` — Maximum duration in milliseconds.<br>`idleMs` — Required network-idle window in milliseconds. | Wait for DOM content, load, or network-idle state; no state defaults to load. |
+| `await page.events()` | — | Read and clear CDP events buffered for this Page. |
+| `await page.click(selector, { button?, clickCount?, delay?, position?, force?, timeout?, label? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Number of clicks.<br>`delay` — Input delay in milliseconds.<br>`position` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000.<br>`label` — Concise user-visible action description shown with the native mouse highlight. | Click an element with native CDP input. |
+| `await page.dblclick(selector, { button?, delay?, position?, force?, timeout?, label? })` | `button` (left, middle, right) — Mouse button.<br>`delay` — Input delay in milliseconds.<br>`position` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000.<br>`label` — Concise user-visible action description shown with the native mouse highlight. | Double-click an element with native CDP input. |
+| `await page.hover(selector, { position?, force?, timeout?, label? })` | `position` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000.<br>`label` — Concise user-visible action description shown with the native mouse highlight. | Move the mouse over an element. |
+| `await page.dragAndDrop(source, target, { button?, sourcePosition?, targetPosition?, force?, timeout?, label? })` | `button` (left, middle, right) — Mouse button.<br>`sourcePosition` — CSS-pixel offset from the element's top-left corner.<br>`targetPosition` — CSS-pixel offset from the element's top-left corner.<br>`force` — Bypass pointer interception checks.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000.<br>`label` — Concise user-visible action description shown with the native mouse highlight. | Drag from one element to another. |
+| `await page.fill(selector, value, { clearFirst?, timeout? })` | `clearFirst` — Clear the current value before filling.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Fill the selected field, its editing host, or its unique fillable descendant, then confirm editing took effect. |
+| `await page.selectOption(selector, valueOrValues, { timeout? })` | `timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Select by a value-or-label string or { value?, label?, index? }; arrays select multiple options, while null or [] clears the selection. The select must be enabled, but disabled options remain programmatically selectable. |
+| `await page.focus(selector, { timeout? })` | `timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Focus the element, its nearest interactive ancestor, or its unique editable descendant. |
+| `await page.press(selector, chord, { delay?, timeout? })` | `delay` — Input delay in milliseconds.<br>`timeout` — Maximum wait for the element to become usable in milliseconds; defaults to 3000. | Focus one element and press a key or shortcut chord. |
+| `await page.setInputFiles(selector, pathOrPaths)` | — | Set files on a file input resolved from the input, its label, or a unique descendant. |
+| `page.waitForFileChooser({ timeout? })` | `timeout` — Maximum duration in milliseconds. | Wait for a dynamically created file chooser. |
+| `await page.close()` | — | Close this Page after confirming its tab disappeared. |
## Page.mouse
-| API | Options | Purpose |
-| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
-| `await page.mouse.click(x, y, { button?, clickCount?, delay? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Number of clicks.<br>`delay` — Input delay in milliseconds. | Click CSS-pixel coordinates with native CDP input. |
-| `await page.mouse.move(x, y, { steps? })` | `steps` — Number of movement steps. | Move the mouse to CSS-pixel coordinates. |
-| `await page.mouse.down({ button?, clickCount? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Click count reported to the page. | Press a mouse button at the current Page position. |
-| `await page.mouse.up({ button?, clickCount? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Click count reported to the page. | Release a mouse button at the current Page position. |
-| `await page.mouse.wheel(deltaX, deltaY)` | — | Perform a short wheel-input motion at the current Page position; move or click over the intended scroll container first in each process. |
+| API | Options | Purpose |
+| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
+| `await page.mouse.click(x, y, { button?, clickCount?, delay?, label? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Number of clicks.<br>`delay` — Input delay in milliseconds.<br>`label` — Concise user-visible action description shown with the native mouse highlight. | Click CSS-pixel coordinates with native CDP input. |
+| `await page.mouse.move(x, y, { steps?, label? })` | `steps` — Number of movement steps.<br>`label` — Concise user-visible action description shown with the native mouse highlight. | Move the mouse to CSS-pixel coordinates. |
+| `await page.mouse.down({ button?, clickCount? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Click count reported to the page. | Press a mouse button at the current Page position. |
+| `await page.mouse.up({ button?, clickCount? })` | `button` (left, middle, right) — Mouse button.<br>`clickCount` — Click count reported to the page. | Release a mouse button at the current Page position. |
+| `await page.mouse.wheel(deltaX, deltaY, { label? })` | `label` — Concise user-visible action description shown with the native mouse highlight. | Perform a short wheel-input motion at the current Page position; move or click over the intended scroll container first in each process. |
## Page.keyboard