I needed three 1280x800 screenshots for my Edge Add-ons listing. The obvious tool kept failing, and the fix was to stop screenshotting pages and start screenshotting rectangles.

What kept failing

chrome --headless --screenshot timed out three times at 25 seconds, even with --no-proxy-server. The page I needed was a real ChatGPT shared conversation, and the headless one-shot path just never came back.

My first puppeteer attempt (part A) got further — it loaded the real share page, ran a real export through the extension, and produced the base image — but died mid-run on a CDP Runtime.callFunctionOn timeout while screenshotting an element on the live page. My best guess is renderer contention: the share page was still doing work while I asked CDP to evaluate and capture in the same breath.

What worked: evaluate + clip, no live site at all

Part B never loads a real site. It opens a blank page, builds the DOM I need with page.evaluate, and screenshots a clipped rectangle:

await page.setViewport({ width: 1280, height: 800 }); await page.evaluate(() => { // build the UI under test from real data, in the page itself }); await page.screenshot({ path: 'shot.png', clip: { x: 0, y: 0, width: 1280, height: 800 } }); 

Whole run: 8 seconds, all green. Three screenshots, all 1280x800, all passed a visual check:

  1. Hero: the real ChatGPT share page with the real extension popup composited on top (only the positions are synthetic).
  2. The exported Markdown view: the extension's real buildMarkdown output — an 8,226-byte file, 11 user turns and 5 assistant turns — rendered in an editor-style view, scrolled to the first assistant turn.
  3. The options page, shot as-is.

Two small bugs the screenshots caught

Shooting real UI caught two things unit tests didn't: the popup's status text was being dyed red by a leftover error class, and the editor's filename bar scrolled away with the content instead of staying sticky. Both were one-line fixes.

The lesson

Long-lived pages plus full-page screenshots are the combination that hangs. A fresh page, a viewport-sized clip, and data rendered by page.evaluate is boring and fast — 8 seconds for the whole set, after three 25-second timeouts.

The extension (ConvoExport) is in review on Edge Add-ons; its privacy page is at https://alapha888.github.io/convo-export-privacy/ .