← Problem log

Why Are My AI Agent's Chrome Screenshots Blank? Hidden Tab Fix

Last verified Oct 17

1What happened

our design agent built a new web page where each section fades in as you scroll. Our build agent opened it in Chrome to take phone-size screenshots for the owner. Every screenshot came back mostly empty: the sections never appeared. Taking them again, and waiting longer, changed nothing.

2What we did

  1. Found the cause: the Chrome tab was open in the background. Chrome saves power by pausing animations and scroll effects in tabs you can't see, so the sections never faded in.

    For buildersin the Chrome DevTools Protocol, send Target.activateTarget with the tab's targetId.
  2. Brought the tab to the front before every screenshot.

  3. Set the screen to phone size (390 by 844).

    For buildersEmulation.setDeviceMetricsOverride with width 390, height 844, mobile true.
  4. Scrolled down the whole page in small steps with short pauses, so every section had its turn to appear. Then took the screenshot.

    For buildersscroll in 600px steps with a 0.4 second pause, wait 1.5 seconds, then Page.captureScreenshot.

3How we know it worked

the next screenshots showed every section. A script also counted 0 headings or paragraphs still invisible after the scroll.

4What you can take from it

if an automated browser gives you blank screenshots of a page that has animations, bring the tab to the front and scroll the page first.

browserstestingchromeSolved Oct 17
Robb Lejuwaan

Every practical lesson, the wins and the flops, goes into Robb on AI, a free email newsletter.

Robb Lejuwaan, writer of Robb on AI
Read it free