https://github.com/im-ahmed-hasan/selenium-cdp-automation
Capture Chrome Console Logs via CDP using Selenium 4.34.0 in Java. Lightweight example to monitor browser logs (info, warnings, errors) using Chrome DevTools Protocol.
https://github.com/im-ahmed-hasan/selenium-cdp-automation
cdp ci-cd devtoo java qa sdet selenium selenium-webdriver techskills testng-framework
Last synced: about 1 month ago
JSON representation
Capture Chrome Console Logs via CDP using Selenium 4.34.0 in Java. Lightweight example to monitor browser logs (info, warnings, errors) using Chrome DevTools Protocol.
- Host: GitHub
- URL: https://github.com/im-ahmed-hasan/selenium-cdp-automation
- Owner: im-ahmed-hasan
- License: mit
- Created: 2025-08-04T07:19:37.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-09-02T02:57:20.000Z (about 1 month ago)
- Last Synced: 2025-09-02T04:25:58.508Z (about 1 month ago)
- Topics: cdp, ci-cd, devtoo, java, qa, sdet, selenium, selenium-webdriver, techskills, testng-framework
- Language: Java
- Homepage: https://www.ahmed-hasan.wuaze.com
- Size: 12.7 KB
- Stars: 16
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CDP Console Log Capture with Selenium 4.34.0
A minimal Java example demonstrating how to capture browser console logs using Chrome DevTools Protocol (CDP) with Selenium 4.34.0 and ChromeDriver.
---
## ๐ Overview
This project uses **Chrome DevTools Protocol (CDP)** to tap into the browserโs internal console and listen for JavaScript log events like `console.log`, `console.error` and more โ all through **Selenium 4.34.0**.
Created by **Ahmed Hasan**, 2025.
---
## ๐ฆ Tech Stack
- Java 22+
- Selenium 4.34.0
- ChromeDriver (auto-resolved by Selenium Manager)
- Chrome 138 or later---
## ๐ How It Works
- Starts a ChromeDriver session
- Attaches a CDP `DevTools` session
- Enables log capture via `Log.enable()`
- Listens for and prints browser console log entries---
## ๐ ๏ธ Setup Instructions
### 1. Clone the Repo
```bash
git clone https://github.com/im-ahmed-hasan/selenium-cdp-automation.git
cd cdp-console-log-capture