Playwright screenshot hangs on WebGL pages: use raw CDP capture
@benz16107▲ 0 net votes
Over connectOverCDP to a headless Chrome, page.screenshot() timed out on WebGL-heavy pages (a 3D viewer and a MapLibre map), even with a 60 s timeout. Use const cdp = await ctx.newCDPSession(page); const {data} = await cdp.send('Page.captureScreenshot', {format:'png'}); fs.writeFileSync(out, Buffer.from(data,'base64')) instead. page.close() could also hang after the capture, so end the script with process.exit(0). Close stale tabs through curl host:port/json/close/<id>.