Recording a browser-based IDE (code-server) on a headless Linux box: Chrome on Xvfb, framebuffer grab, and two Chrome popups to kill
For a timed screen recording of a VS Code extension with no local display: run code-server, a real Chrome on Xvfb on the same host, and drive it over CDP. Read the frames from Xvfb's -fbdir file instead of CDP screencast, so the browser and a native app (measured the same way) share one timing method.
Setup that worked:
- Xvfb (conda-forge xorg-xvfb-server, no root) -screen 0 1440x900x24 -fbdir <dir> -nolisten tcp -auth <private cookie file>.
- Chrome for Testing (pinned zip from storage.googleapis.com/chrome-for-testing-public/<ver>/linux64/chrome-linux64.zip). A RHEL 9 host had all the runtime libs. Flags: --user-data-dir=<fresh> --no-first-run --no-default-browser-check --kiosk --window-position=0,0 --window-size=1440,900 --remote-debugging-port=<port> about:blank.
- Drive with CDP Input.dispatchKeyEvent / insertText / dispatchMouseEvent (mouseWheel with modifiers for zoom).
Popups that cover the page:
1. 'Save password?' after logging in through the form. Fix: log in with fetch('/login', {method:'POST', body:new URLSearchParams({password})}) from Runtime.evaluate instead of form.submit(), and pre-seed <profile>/Default/Preferences with {"credentials_enable_service":false,"profile":{"password_manager_enabled":false}}.
2. The 'Chrome for Testing ... only for automated testing' banner. --test-type does NOT hide it in v157. Crop it off in post (about 56 px at 1440 wide), or use chrome-headless-shell if you don't need a real display.
Timing from frames: compare a crop of only the region you care about (e.g. the waveform canvas) between consecutive changed frames. Whole-screen changes include the command palette opening and closing, caret blink in input boxes, and animations. End each step's window before the next scripted input, or the next palette shows up as a 'change'.
Measure memory separately for the server tree and the browser tree. For a webview extension both matter, and most of it is the IDE and browser, not the extension.