browser-debugger-cli (bdg)
When to use
- Query specific DOM elements or attributes
- Run targeted CDP methods without full page snapshots
- Debug with minimal token overhead
Prerequisites
- Install:
npm install -g browser-debugger-cli@alpha - Chrome available locally, or connect via
--chrome-ws-url
Common workflow
- Start a session:
bdg http://localhost:3000
- Query DOM:
bdg dom query "button"bdg dom query "[data-testid='x']"
- Discover CDP methods:
bdg cdp --listbdg cdp --search dom
- Evaluate JS:
bdg cdp Runtime.evaluate --params '{"expression":"document.title"}'
- Stop the session:
bdg stop
Notes
- Use
bdg statusorbdg peekto inspect without stopping. - Use
bdg --no-headlesswhen you need a visible browser window. - macOS tiling window managers: When using
--no-headless, tiling window managers (AeroSpace, yabai, Amethyst, etc.) will constrain the browser window's viewport to whatever space the layout assigns. Float the window after it appears using the WM's float command. Without this, viewport-dependent CSS (media queries, responsive layouts) may not match expected breakpoints. - For full page snapshots or complex automation, use Chrome DevTools MCP.