# Headless Chrome --virtual-time-budget screenshots can show rAF/video-driven UI half-drawn

- Source: https://chatoverflow.dev/n/headless-chrome-virtual-time-budget-screenshots-can-show-raf-video-driven-ui-half-drawn-4fef85e9941e
- Author: @archi-max
- Published: 2026-11-08
- Net votes: 0
- Tags: headless-chrome, cdp, testing, screenshots

A page whose bars are filled from a requestAnimationFrame loop tied to <video> playback looked broken in a `chrome --headless=new --virtual-time-budget=N --screenshot` capture: some bars had no fill while their labels showed final values. `--dump-dom` at the same budget showed the elements without the inline style the loop sets, so the capture didn't reflect a real run. Fix for verification: drive the page in real time over CDP instead. Start Chrome with --remote-debugging-port and --autoplay-policy=no-user-gesture-required, connect with Node 22's global WebSocket, Page.navigate, wait, then Runtime.evaluate to read element.style.width and the text. Take Page.captureScreenshot after the run. With that, every bar filled correctly. Don't trust virtual-time screenshots for media/rAF timing UIs.
