Welcome! This project demonstrates how to interact with Chrome's Remote Debugging Protocol using Node.js. It provides an interactive command-line interface to explore and execute Chrome DevTools Protocol (CDP) commands through WebSocket connections.
This tool allows you to:
- Connect to a Chrome browser instance via WebSocket
- Execute Chrome DevTools Protocol (CDP) commands interactively
- Navigate pages, capture screenshots, evaluate JavaScript, and much more
- Save request configurations and responses as JSON files
- Learn and experiment with browser automation
Perfect for developers interested in browser automation, web scraping, testing, or understanding how tools like Puppeteer work under the hood!
- Node.js (v14 or higher) - Download here
- Chrome/Chromium browser (automatically installed via npm)
- Clone the repository
git clone https://github.com/tarsislimadev/remotedebugging.git
cd remotedebugging- Install dependencies
npm ciThis will also automatically install a compatible Chrome browser for remote debugging.
Open a terminal and start Chrome with remote debugging enabled:
Windows:
.\chrome\win64-146.0.7680.80\chrome-win64\chrome.exe --remote-debugging-port=9222Linux/Mac:
./chrome/chrome --remote-debugging-port=9222This opens Chrome with a debugging port on localhost:9222.
In a new terminal window, start the application:
node app.jsThe app displays an interactive menu where you can:
- Select CDP methods (Page, Runtime, DOM, Network, etc.)
- Configure parameters for each command
- Save requests for later reuse
- Execute commands and view responses
All responses are automatically saved to the responses/ directory as timestamped JSON files.
- WebSocket Connection: The app connects to Chrome's debugging WebSocket endpoint
- Interactive Menu: Choose from available CDP methods organized by domain
- Send Commands: Compose and send JSON-RPC style commands to Chrome
- Receive Responses: Chrome responds with data (screenshots, DOM info, etc.)
- Save & Reuse: Save configurations and replay requests
Commands follow the Chrome DevTools Protocol format:
{
"id": 1,
"method": "Page.navigate",
"params": {
"url": "https://example.com"
}
}remotedebugging/
├── app.js # Main application entry point
├── menu.js # Interactive menu and command definitions
├── package.json # Project dependencies and scripts
├── responses/ # Saved JSON responses from Chrome
└── README.md # This file
- Chrome DevTools Protocol - Official CDP documentation
Contributions are welcome! Feel free to:
- Report bugs via GitHub Issues
- Submit pull requests with improvements
- Share your use cases and ideas
This project is open source. See the repository for license details.
- Start with simple commands like
Page.navigateorPage.captureScreenshot - Check the
docs/folder for detailed explanations and examples - Responses are saved in
responses/- inspect them to understand the data structure - Use the Chrome DevTools Protocol Viewer to explore all available commands
- Experiment and have fun! This is a learning tool.
Happy Debugging! 🐛✨
For questions or support, open an issue on GitHub or check the documentation in the docs/ folder.