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.

docs(ego-browser): document the screenshot timeout and its canvas fallback

Joway@MacMiniffc12af5a619
diff --git a/package/ego-browser/skill-body/SKILL.md b/package/ego-browser/skill-body/SKILL.md
index f30630e..b8784c3 100644
--- a/package/ego-browser/skill-body/SKILL.md
+++ b/package/ego-browser/skill-body/SKILL.md
@@ -395,6 +395,18 @@ it at scale. Canvas-backed editors may not expose visible content through DOM
text or selectors; verify those results with a screenshot or an
application-specific visible state.
+`page.screenshot()` can sometimes fail after about 15s with
+`EGO_PAGE_UNRESPONSIVE` and `method: "Page.captureScreenshot"`, even if the Page
+still answers `evaluate()`; the message may blame a navigation. Retry at most
+once. For a canvas, read its pixels instead (tainted canvases throw; WebGL may
+read blank):
+
+```js
+const png = await page.evaluate(() =>
+ document.querySelector("canvas").toDataURL("image/png"),
+);
+```
+
### Page JavaScript and CDP
Use `page.evaluate()` for bulk extraction or complex in-page work. It accepts
diff --git a/package/ego-browser/src/page-model.test.mjs b/package/ego-browser/src/page-model.test.mjs
index 7935f74..738ae90 100644
--- a/package/ego-browser/src/page-model.test.mjs
+++ b/package/ego-browser/src/page-model.test.mjs
@@ -7741,6 +7741,31 @@ test("screenshot stops a pending navigation when the Page never answers its rend
});
});
+test("a screenshot capture timeout reports EGO_PAGE_UNRESPONSIVE naming Page.captureScreenshot", async () => {
+ await withFixture(async (fixture) => {
+ const task = taskForRound(fixture, "round-a", {
+ async screenshot(path, options, sessionId) {
+ throw new CdpRequestTimeoutError(
+ "Page.captureScreenshot",
+ 15_000,
+ sessionId,
+ );
+ },
+ });
+ const page = await openTestPage(task, "https://example.test/canvas");
+
+ await assert.rejects(
+ () => page.screenshot(),
+ (error) => {
+ assert.equal(error.code, "EGO_PAGE_UNRESPONSIVE");
+ assert.equal(error.method, "Page.captureScreenshot");
+ assert.equal(error.waitedMs, 15_000);
+ return true;
+ },
+ );
+ });
+});
+
test("a browser-level command timeout is not treated as an unresponsive Page", async () => {
await withFixture(async (fixture) => {
let stops = 0;
diff --git a/package/ego-browser/src/skill-package.test.mjs b/package/ego-browser/src/skill-package.test.mjs
index d5e91a4..78badec 100644
--- a/package/ego-browser/src/skill-package.test.mjs
+++ b/package/ego-browser/src/skill-package.test.mjs
@@ -89,6 +89,21 @@ test("each platform guide keeps only its own passages", async () => {
assert.ok(guides.macos.length < guides.windows.length);
});
+test("the visual pages guide says how to recover from a screenshot timeout", async () => {
+ const guide = await readFile(join(outDir, "ego-browser/SKILL.md"), "utf8");
+ const section = /^### Visual pages:[\s\S]*?(?=^### )/m.exec(guide)?.[0] ?? "";
+ assert.match(section, /EGO_PAGE_UNRESPONSIVE/);
+ assert.match(section, /Page\.captureScreenshot/);
+ assert.match(section, /at most once/);
+ assert.match(section, /\.toDataURL\("image\/png"\)/);
+ assert.match(section, /page\.evaluate\(/);
+ assert.match(section, /tainted/);
+ assert.match(section, /WebGL/);
+ // The cause of the hang is not established, so the guide must stay conditional.
+ assert.match(section, /can sometimes/);
+ assert.doesNotMatch(section, /minimi[sz]ed|occluded|background window/i);
+});
+
test("renderGuide selects platform blocks and strips the markers", () => {
const source = [
"---",