Skip to main content

What is CDP?

The Chrome DevTools Protocol (CDP) allows for tools to instrument, inspect, debug and profile Chromium-based browsers. nodriver includes a complete CDP implementation with type-safe Python bindings for all CDP domains, methods, and events.

Available Domains

nodriver’s CDP module includes bindings for all Chrome DevTools Protocol domains:

Core Domains

  • Browser - Browser-level operations
  • Page - Page-level operations, navigation, screenshots
  • DOM - DOM tree access and manipulation
  • Runtime - JavaScript execution and remote objects
  • Network - Network monitoring and modification
  • Input - Input event simulation (mouse, keyboard, touch)

Debugging & Profiling

  • Debugger - JavaScript debugging
  • Profiler - CPU profiling
  • HeapProfiler - Memory profiling
  • Performance - Performance metrics
  • PerformanceTimeline - Performance timeline events

Inspection & Testing

  • Accessibility - Accessibility tree inspection
  • CSS - CSS manipulation
  • DOMDebugger - DOM breakpoints
  • DOMSnapshot - DOM snapshot capture
  • Overlay - Visual overlays and highlighting

Storage & Data

  • Storage - Storage management (localStorage, sessionStorage, IndexedDB)
  • IndexedDB - IndexedDB operations
  • CacheStorage - Cache API operations
  • DOMStorage - DOM storage operations

Emulation & Devices

  • Emulation - Device emulation
  • DeviceOrientation - Device orientation override

Media & Graphics

  • Media - Media inspection
  • WebAudio - Web Audio API inspection
  • Animation - Animation inspection and control
  • LayerTree - Compositing layer tree

Security & Permissions

  • Security - Security state inspection
  • ServiceWorker - Service worker management
  • WebAuthn - Web Authentication API

Advanced

  • Target - Target (tab/page) management
  • Fetch - Network request interception
  • Log - Console log entries
  • Tracing - Chrome tracing
  • IO - Input/output operations
  • Schema - Protocol schema inspection
And many more specialized domains.

CDP Package Structure

The CDP module is organized by domain:

Domain Components

Each CDP domain contains:

Methods (Commands)

Functions that send commands to the browser and return results:

Events

Classes representing events emitted by the browser:

Types

Data classes representing CDP types:

Type Safety

All CDP bindings are fully typed with:
  • Type hints for all parameters and return values
  • Dataclasses for complex types
  • Enums for enumerated values
  • Optional types for optional parameters

Auto-Generated Documentation

The CDP module is auto-generated from the Chrome DevTools Protocol specification, ensuring:
  • Complete coverage of all CDP features
  • Up-to-date with latest Chrome versions
  • Accurate type definitions
  • Comprehensive docstrings

Examples

Take screenshot with CDP

Monitor network requests

Execute JavaScript

When to Use CDP Directly

Use CDP directly when you need:
  • Low-level control - Fine-grained control over browser behavior
  • Advanced features - Features not exposed in high-level API
  • Performance optimization - Minimize overhead with direct commands
  • Event monitoring - Listen to specific browser events
  • Protocol compliance - Follow exact CDP specifications

High-Level API vs CDP

nodriver provides high-level methods that use CDP internally:
Use the high-level API when possible, and CDP when you need specific control.

See Also