.agents/skills/local-testing/references/record-app-screen.md
General-purpose screen recording tool for the Electron app. Captures CDP screenshots as video frames and gallery snapshots, then assembles into an MP4 on stop.
# Start recording (Electron must be running with CDP)
.agents/skills/local-testing/scripts/record-app-screen.sh start [output_name]
# Stop recording and assemble video
.agents/skills/local-testing/scripts/record-app-screen.sh stop
# Check if recording is active
.agents/skills/local-testing/scripts/record-app-screen.sh status
| Argument | Default | Description |
|---|---|---|
output_name | recording-YYYYMMDD-HHMMSS | Base name for output files |
| Variable | Default | Description |
|---|---|---|
CDP_PORT | 9222 | Chrome DevTools Protocol port |
SCREENSHOT_INTERVAL | 3 | Seconds between gallery screenshots |
VIDEO_FRAME_INTERVAL | 0.5 | Seconds between video frames (~2 fps) |
.records/
<name>.mp4 # Video assembled from frames (~2 fps)
<name>/ # Gallery screenshots (every 3s)
0000.png
0001.png
0002.png
...
The .records/ directory is at the project root and is gitignored.
agent-browser screenshot every VIDEO_FRAME_INTERVAL seconds into a temp directory (/tmp/record-frames-XXXXXX/)agent-browser screenshot every SCREENSHOT_INTERVAL seconds into .records/<name>//tmp/record-app-screen.pids and /tmp/record-app-screen.stateffmpeg -framerate 2 -i frame_%06d.png -c:v libx264 -crf 23 -pix_fmt yuv420p <output>.mp4
# Start Electron
.agents/skills/local-testing/scripts/electron-dev.sh start
# Start recording
.agents/skills/local-testing/scripts/record-app-screen.sh start my-test
# Run automation
agent-browser --cdp 9222 click @e61
agent-browser --cdp 9222 type @e42 "hello"
agent-browser --cdp 9222 press Enter
sleep 10
# Stop and get results
.agents/skills/local-testing/scripts/record-app-screen.sh stop
# → .records/my-test.mp4 + .records/my-test/*.png
.agents/skills/local-testing/scripts/electron-dev.sh start
# Inject gateway URL
agent-browser --cdp 9222 eval --stdin << 'EOF'
(function() {
var store = window.global_serverConfigStore;
store.setState({ serverConfig: { ...store.getState().serverConfig,
agentGatewayUrl: 'https://agent-gateway.lobehub.com' } });
return 'ready';
})()
EOF
# Record
.agents/skills/local-testing/scripts/record-app-screen.sh start gateway-demo
# Navigate to agent, send message, wait for completion...
# (automation commands here)
.agents/skills/local-testing/scripts/record-app-screen.sh stop
open .records/gateway-demo.mp4
.agents/skills/local-testing/scripts/record-app-screen.sh status
# [record] Active recording
# Frames: 42 captured (running: yes)
# Screenshots: 14 captured (running: yes)
# Output: .records/my-test.mp4
bun add -g ffmpeg-static or brew install ffmpegnpm i -g agent-browserelectron-dev.sh start)| Problem | Solution |
|---|---|
| "No active recording found" on stop | PID file was cleaned up. Check if background processes are still running with ps aux | grep agent-browser |
| "A recording is already active" | Run stop first, or manually clean: rm /tmp/record-app-screen.pids /tmp/record-app-screen.state |
| Video is 0 bytes | No frames were captured. Ensure Electron is running and CDP port is correct |
| Screenshots are blank/white | SPA may not have loaded yet. Wait for electron-dev.sh to report "Renderer ready" |
| ffmpeg assembly fails | Check /tmp/ffmpeg-assemble.log. Ensure ffmpeg is installed and frames exist |