A comprehensive browser automation and data extraction tool built with TypeScript and Playwright. Extract and analyze complete browser state including network traffic, console logs, DOM elements, scripts, styles, performance metrics, and much more.
Each data collection module can be independently enabled/disabled:
- Network - HTTP requests/responses with headers and bodies
- Console - Logs, warnings, errors, and browser dialogs
- Elements - DOM element information and CDP listeners
- Scripts - JavaScript files and inline scripts
- CSS - Stylesheets and computed styles
- Application - Cookies, local storage, session storage, IndexedDB
- Security - SSL/TLS and security headers
- Performance - Performance traces and metrics
- Accessibility - Accessibility tree
- Media - Audio/video element statistics
- WebGL - Canvas and WebGL details
- Memory - Heap snapshots
- Service Worker - Service worker registration info
Each collector's data is automatically organized into its own folder:
output/
βββ network/
β βββ network-1763561850014.json
β βββ click-1763561850014/
βββ console/
β βββ console-1763561850014.json
βββ elements/
β βββ elements-1763561850014.json
βββ scripts/
βββ css/
βββ application/
βββ security/
βββ performance/
βββ accessibility/
βββ media/
βββ webgl/
βββ memory/
βββ serviceWorker/
βββ analysis-1763561850014.json (combined analysis)
Easily control which collectors are active via config.json:
{
"targetUrl": "https://www.i2ocr.com/pdf-ocr-persian",
"headless": false,
"slowMo": 80,
"collectors": {
"network": { "enabled": true, "description": "..." },
"console": { "enabled": true, "description": "..." },
...
}
}- Automatically injects click listeners into pages
- Captures click event metadata instantly
- Saves partial snapshots immediately (non-blocking)
- Runs full data collection in background
- Prevents blocking of page behavior (e.g., captcha)
npm installnpm startThis will:
- Load configuration from
config.json - Launch a Chromium browser
- Navigate to the target URL
- Listen for clicks and collect data as you interact
- Export all collected data when you close the browser
Use the collector CLI to enable/disable modules:
# List all collectors and their status
npm run collectors list
# Enable a specific collector
npm run collectors enable network
npm run collectors enable console
# Disable a specific collector
npm run collectors disable memory
npm run collectors disable webgl
# Toggle a collector on/off
npm run collectors toggle performance
# Check status of a single collector
npm run collectors status console
# Enable all collectors
npm run collectors enable-all
# Disable all collectors
npm run collectors disable-allMinimal Configuration - Only collect network and console:
npm run collectors disable-all
npm run collectors enable network
npm run collectors enable console
npm run collectors enable elements
npm startPerformance Analysis - Focus on performance metrics:
npm run collectors disable-all
npm run collectors enable performance
npm run collectors enable media
npm run collectors enable webgl
npm startFull Analysis - Collect everything:
npm run collectors enable-all
npm startanalysis-<timestamp>.json- Combined analysis containing all enabled collectors' data<collector-name>/<collector-name>-<timestamp>.json- Individual collector data files
click-<timestamp>.partial.json- Quick snapshot saved immediately on clickclick-<timestamp>.json- Full detailed analysis (saved in background)click-<timestamp>.html- HTML snapshot of the pageclick-<timestamp>.png- Screenshot<collector-name>/click-<timestamp>/- Collector-specific click data
Edit config.json to customize:
{
"targetUrl": "https://your-target-url.com",
"headless": false, // Set to true for headless mode
"slowMo": 80, // Slow down browser actions (ms)
"collectors": { ... } // Enable/disable specific collectors
}βββ config.json # Collector configuration
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ src/
β βββ main.ts # Main entry point
β βββ types.ts # TypeScript type definitions
β βββ bin/
β β βββ collector-cli.ts # CLI for managing collectors
β βββ collectors/ # Data collection modules
β β βββ networkCollector.ts
β β βββ consoleCollector.ts
β β βββ elementsCollector.ts
β β βββ scriptsCollector.ts
β β βββ cssCollector.ts
β β βββ applicationCollector.ts
β β βββ securityCollector.ts
β β βββ performanceCollector.ts
β β βββ accessibilityCollector.ts
β β βββ mediaCollector.ts
β β βββ webglCollector.ts
β β βββ memoryCollector.ts
β β βββ serviceWorkerCollector.ts
β βββ utils/
β βββ configManager.ts # Configuration management
β βββ cdpClient.ts # Chrome DevTools Protocol
β βββ fileUtils.ts # File utilities
β βββ logger.ts # Logging utilities
βββ output/ # Generated data (organized by module)
// Load configuration
loadConfig(): Config
// Check if collector is enabled
isCollectorEnabled(collectorName: string): boolean
// Get all enabled collectors
getEnabledCollectors(): string[]
// Enable/disable collectors
enableCollector(collectorName: string): void
disableCollector(collectorName: string): void
// Create module directory
createModuleDir(outputDir: string, moduleName: string): string
// Ensure all module directories exist
ensureModuleDirs(outputDir: string): voidSet via environment variable:
TARGET_URL=https://example.com npm startimport { isCollectorEnabled, enableCollector } from './src/utils/configManager';
// Check if enabled
if (isCollectorEnabled('network')) {
// Handle network collection
}
// Enable dynamically
enableCollector('performance');- Network Collector: Stores response bodies on disk (can use significant space)
- Memory Collector: Heap snapshots can be large; disable if disk space is limited
- Performance Traces: Can be 10-50 MB depending on page activity
- slowMo Setting: Increase for slower systems; decrease for faster collection
- Ensure
config.jsonexists in project root - Check JSON syntax is valid
- Use
npm run collectors listto verify status - Check that collector name matches exactly (case-sensitive)
- Disable memory-intensive collectors (memory, webgl)
- Enable only required collectors
- Ensure Playwright dependencies are installed:
npm install - Check Chromium is not already running
MIT
Saeed Dehghan