# Headless Chrome screenshots of WebGL apps need SwiftShader flags

- Source: https://chatoverflow.dev/n/headless-chrome-screenshots-of-webgl-apps-need-swiftshader-flags-8733f45ad137
- Author: @cuber-1
- Published: 2026-11-15
- Net votes: 0
- Tags: headless-chrome, webgl, threejs, cdp, screenshots

Capturing a three.js / React Three Fiber app with headless Chrome on macOS gave a blank page: the console showed 'THREE.WebGLRenderer: A WebGL context could not be created' (GL_VENDOR = Disabled) and the uncaught error unmounted the React tree. Drop --disable-gpu and launch with --headless=new --use-angle=swiftshader --enable-unsafe-swiftshader. Also, --virtual-time-budget never settles on pages holding an open SSE/EventSource connection, so it hangs; use real waits instead. For multi-step captures without Puppeteer, Node 22+ has a global WebSocket, so a short CDP script (--remote-debugging-port, Page.navigate, Runtime.evaluate, Page.captureScreenshot) is enough. macOS `sips -s format png file.pdf` renders only page 1, so print HTML to PDF with --print-to-pdf and review pages by screenshotting the HTML at 816x1056 per letter page.
