Chrome DevTools Protocol (CDP) Domains Reference
Complete reference of CDP domains and their capabilities for browser automation and debugging.
Overview
CDP is organized into 47 domains, each providing specific browser capabilities. Domains are grouped by functionality:
- Core - Fundamental browser control
- DOM & Styling - Page structure and styling
- Network & Fetch - HTTP traffic management
- Page & Navigation - Page lifecycle control
- Storage & Data - Browser storage APIs
- Performance & Profiling - Metrics and analysis
- Emulation & Simulation - Device and network emulation
- Worker & Service - Background tasks
- Developer Tools - Debugging support
Core Domains
Runtime
Purpose: Execute JavaScript, manage objects, handle promises
Key Commands:
Runtime.evaluate(expression) - Execute JavaScript
Runtime.callFunctionOn(functionDeclaration, objectId) - Call function on object
Runtime.getProperties(objectId) - Get object properties
Runtime.awaitPromise(promiseObjectId) - Wait for promise resolution
Key Events:
Runtime.consoleAPICalled - Console message logged
Runtime.exceptionThrown - Uncaught exception
Use Cases:
- Execute custom JavaScript
- Access page data
- Monitor console output
- Handle exceptions
Debugger
Purpose: JavaScript debugging, breakpoints, stack traces
Key Commands:
Debugger.enable() - Enable debugger
Debugger.setBreakpoint(location) - Set breakpoint
Debugger.pause() - Pause execution
Debugger.resume() - Resume execution
Debugger.stepOver/stepInto/stepOut() - Step through code
Key Events:
Debugger.paused - Execution paused
Debugger.resumed - Execution resumed
Debugger.scriptParsed - Script loaded
Use Cases:
- Debug JavaScript errors
- Inspect call stacks
- Set conditional breakpoints
- Source map support
Console (Deprecated - Use Runtime/Log)
Purpose: Legacy console message access
Note: Use Runtime.consoleAPICalled event instead for new implementations.
DOM & Styling Domains
DOM
Purpose: Access and manipulate DOM tree
Key Commands:
DOM.getDocument() - Get root document node
DOM.querySelector(nodeId, selector) - Query selector
DOM.querySelectorAll(nodeId, selector) - Query all
DOM.getAttributes(nodeId) - Get element attributes
DOM.setOuterHTML(nodeId, outerHTML) - Replace element
DOM.getBoxModel(nodeId) - Get element layout box
DOM.focus(nodeId) - Focus element
Key Events:
DOM.documentUpdated - Document changed
DOM.setChildNodes - Child nodes updated
Use Cases:
- Navigate DOM tree
- Query elements
- Modify DOM structure
- Get element positions
CSS
Purpose: Inspect and modify CSS styles
Key Commands:
CSS.enable() - Enable CSS domain
CSS.getComputedStyleForNode(nodeId) - Get computed styles
CSS.getInlineStylesForNode(nodeId) - Get inline styles
CSS.getMatchedStylesForNode(nodeId) - Get matched CSS rules
CSS.setStyleTexts(edits) - Modify styles
Key Events:
CSS.styleSheetAdded - Stylesheet added
CSS.styleSheetChanged - Stylesheet modified
Use Cases:
- Inspect element styles
- Debug CSS issues
- Modify styles dynamically
- Extract stylesheet data
Accessibility
Purpose: Access accessibility tree
Key Commands:
Accessibility.enable() - Enable accessibility
Accessibility.getFullAXTree() - Get complete AX tree
Accessibility.getPartialAXTree(nodeId) - Get node subtree
Accessibility.queryAXTree(nodeId, role, name) - Query AX tree
Use Cases:
- Accessibility testing
- Screen reader simulation
- ARIA attribute inspection
- AX tree analysis
Network & Fetch Domains
Network
Purpose: Monitor and control HTTP traffic
Key Commands:
Network.enable() - Enable network tracking
Network.setCacheDisabled(cacheDisabled) - Disable cache
Network.setExtraHTTPHeaders(headers) - Add custom headers
Network.getCookies(urls) - Get cookies
Network.setCookie(name, value, domain) - Set cookie
Network.getResponseBody(requestId) - Get response body
Network.emulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput) - Throttle network
Key Events:
Network.requestWillBeSent - Request starting
Network.responseReceived - Response received
Network.loadingFinished - Request completed
Network.loadingFailed - Request failed
Use Cases:
- Monitor API calls
- Intercept requests
- Analyze response data
- Simulate slow networks
- Manage cookies
Fetch
Purpose: Intercept and modify network requests
Key Commands:
Fetch.enable(patterns) - Enable request interception
Fetch.continueRequest(requestId, url, method, headers) - Continue/modify request
Fetch.fulfillRequest(requestId, responseCode, headers, body) - Mock response
Fetch.failRequest(requestId, errorReason) - Fail request
Key Events:
Fetch.requestPaused - Request intercepted
Use Cases:
- Mock API responses
- Block requests
- Modify request/response
- Test error scenarios
Page & Navigation Domains
Page
Purpose: Control page lifecycle and navigation
Key Commands:
Page.enable() - Enable page domain
Page.navigate(url) - Navigate to URL
Page.reload(ignoreCache) - Reload page
Page.goBack()/goForward() - Navigate history
Page.captureScreenshot(format, quality) - Take screenshot
Page.printToPDF(landscape, displayHeaderFooter) - Generate PDF
Page.getLayoutMetrics() - Get page dimensions
Page.createIsolatedWorld(frameId) - Create isolated context
Page.handleJavaScriptDialog(accept, promptText) - Handle alerts/confirms
Key Events:
Page.loadEventFired - Page loaded
Page.domContentEventFired - DOM ready
Page.frameNavigated - Frame navigated
Page.javascriptDialogOpening - Alert/confirm shown
Use Cases:
- Navigate pages
- Capture screenshots
- Generate PDFs
- Handle popups
- Monitor page lifecycle
Target
Purpose: Manage browser targets (tabs, workers, frames)
Key Commands:
Target.getTargets() - List all targets
Target.createTarget(url) - Open new tab
Target.closeTarget(targetId) - Close tab
Target.attachToTarget(targetId) - Attach debugger
Target.detachFromTarget(sessionId) - Detach debugger
Target.setDiscoverTargets(discover) - Auto-discover targets
Key Events:
Target.targetCreated - New target created
Target.targetDestroyed - Target closed
Target.targetInfoChanged - Target updated
Use Cases:
- Multi-tab automation
- Service worker debugging
- Frame inspection
- Extension debugging
Input
Purpose: Simulate user input
Key Commands:
Input.dispatchKeyEvent(type, key, code) - Keyboard input
Input.dispatchMouseEvent(type, x, y, button) - Mouse input
Input.dispatchTouchEvent(type, touchPoints) - Touch input
Input.synthesizePinchGesture(x, y, scaleFactor) - Pinch gesture
Input.synthesizeScrollGesture(x, y, xDistance, yDistance) - Scroll
Use Cases:
- Simulate clicks
- Type text
- Drag and drop
- Touch gestures
- Scroll pages
Storage & Data Domains
Storage
Purpose: Manage browser storage
Key Commands:
Storage.getCookies(browserContextId) - Get cookies
Storage.setCookies(cookies) - Set cookies
Storage.clearCookies(browserContextId) - Clear cookies
Storage.clearDataForOrigin(origin, storageTypes) - Clear storage
Storage.getUsageAndQuota(origin) - Get storage usage
Storage Types:
- appcache, cookies, file_systems, indexeddb, local_storage, shader_cache, websql, service_workers, cache_storage
Use Cases:
- Cookie management
- Clear browser data
- Inspect storage usage
- Test quota limits
DOMStorage
Purpose: Access localStorage/sessionStorage
Key Commands:
DOMStorage.enable() - Enable storage tracking
DOMStorage.getDOMStorageItems(storageId) - Get items
DOMStorage.setDOMStorageItem(storageId, key, value) - Set item
DOMStorage.removeDOMStorageItem(storageId, key) - Remove item
Key Events:
DOMStorage.domStorageItemsCleared - Storage cleared
DOMStorage.domStorageItemAdded/Updated/Removed - Item changed
IndexedDB
Purpose: Query IndexedDB databases
Key Commands:
IndexedDB.requestDatabaseNames(securityOrigin) - List databases
IndexedDB.requestDatabase(securityOrigin, databaseName) - Get DB structure
IndexedDB.requestData(securityOrigin, databaseName, objectStoreName) - Query data
Use Cases:
- Inspect IndexedDB data
- Debug database issues
- Extract stored data
CacheStorage
Purpose: Manage Cache API
Key Commands:
CacheStorage.requestCacheNames(securityOrigin) - List caches
CacheStorage.requestCachedResponses(cacheId, securityOrigin) - List cached responses
CacheStorage.deleteCache(cacheId) - Delete cache
Use Cases:
- Service worker cache inspection
- Offline functionality testing
Performance & Profiling Domains
Performance
Purpose: Collect performance metrics
Key Commands:
Performance.enable() - Enable performance tracking
Performance.disable() - Disable tracking
Performance.getMetrics() - Get current metrics
Metrics:
- Timestamp, Documents, Frames, JSEventListeners, Nodes, LayoutCount, RecalcStyleCount, LayoutDuration, RecalcStyleDuration, ScriptDuration, TaskDuration, JSHeapUsedSize, JSHeapTotalSize
Use Cases:
- Monitor page metrics
- Track memory usage
- Measure render times
PerformanceTimeline
Purpose: Access Performance Timeline API
Key Commands:
PerformanceTimeline.enable(eventTypes) - Subscribe to events
Event Types:
- mark, measure, navigation, resource, longtask, paint, layout-shift
Key Events:
PerformanceTimeline.timelineEventAdded - New performance entry
Tracing
Purpose: Record Chrome trace
Key Commands:
Tracing.start(categories, options) - Start recording
Tracing.end() - Stop recording
Tracing.requestMemoryDump() - Capture memory snapshot
Trace Categories:
- blink, cc, devtools, gpu, loading, navigation, rendering, v8, disabled-by-default-*
Key Events:
Tracing.dataCollected - Trace chunk received
Tracing.tracingComplete - Recording finished
Use Cases:
- Deep performance analysis
- Frame rendering profiling
- CPU flame graphs
- Memory profiling
Profiler
Purpose: CPU profiling
Key Commands:
Profiler.enable() - Enable profiler
Profiler.start() - Start CPU profiling
Profiler.stop() - Stop and get profile
Use Cases:
- Find CPU bottlenecks
- Optimize JavaScript
- Generate flame graphs
HeapProfiler (via Memory domain)
Purpose: Memory profiling
Key Commands:
Memory.getDOMCounters() - Get DOM object counts
Memory.prepareForLeakDetection() - Prepare leak detection
Memory.forciblyPurgeJavaScriptMemory() - Force GC
Memory.setPressureNotificationsSuppressed(suppressed) - Control memory warnings
Memory.simulatePressureNotification(level) - Simulate memory pressure
Use Cases:
- Detect memory leaks
- Analyze heap snapshots
- Monitor object counts
Emulation & Simulation Domains
Emulation
Purpose: Emulate device conditions
Key Commands:
Emulation.setDeviceMetricsOverride(width, height, deviceScaleFactor, mobile) - Emulate device
Emulation.setGeolocationOverride(latitude, longitude, accuracy) - Fake location
Emulation.setEmulatedMedia(media, features) - Emulate media type
Emulation.setTimezoneOverride(timezoneId) - Override timezone
Emulation.setLocaleOverride(locale) - Override language
Emulation.setUserAgentOverride(userAgent) - Change user agent
Use Cases:
- Mobile device testing
- Geolocation testing
- Print media emulation
- Timezone/locale testing
DeviceOrientation
Purpose: Simulate device orientation
Key Commands:
DeviceOrientation.setDeviceOrientationOverride(alpha, beta, gamma) - Set orientation
Use Cases:
- Test accelerometer features
- Orientation-dependent layouts
Worker & Service Domains
ServiceWorker
Purpose: Manage service workers
Key Commands:
ServiceWorker.enable() - Enable tracking
ServiceWorker.unregister(scopeURL) - Unregister worker
ServiceWorker.startWorker(scopeURL) - Start worker
ServiceWorker.stopWorker(versionId) - Stop worker
ServiceWorker.inspectWorker(versionId) - Debug worker
Key Events:
ServiceWorker.workerRegistrationUpdated - Registration changed
ServiceWorker.workerVersionUpdated - Version updated
WebAuthn
Purpose: Simulate WebAuthn/FIDO2
Key Commands:
WebAuthn.enable() - Enable virtual authenticators
WebAuthn.addVirtualAuthenticator(options) - Add virtual device
WebAuthn.removeVirtualAuthenticator(authenticatorId) - Remove device
WebAuthn.addCredential(authenticatorId, credential) - Add credential
Use Cases:
- Test WebAuthn flows
- Simulate biometric auth
- Test security keys
Developer Tools Support
Inspector
Purpose: Protocol-level debugging
Key Events:
Inspector.detached - Debugger disconnected
Inspector.targetCrashed - Target crashed
Log
Purpose: Collect browser logs
Key Commands:
Log.enable() - Enable log collection
Log.clear() - Clear logs
Key Events:
Log.entryAdded - New log entry
Use Cases:
- Collect console logs
- Monitor violations
- Track deprecations
DOMDebugger
Purpose: DOM-level debugging
Key Commands:
DOMDebugger.setDOMBreakpoint(nodeId, type) - Break on DOM changes
DOMDebugger.setEventListenerBreakpoint(eventName) - Break on event
DOMDebugger.setXHRBreakpoint(url) - Break on XHR
Breakpoint Types:
- subtree-modified, attribute-modified, node-removed
DOMSnapshot
Purpose: Capture complete DOM snapshot
Key Commands:
DOMSnapshot.captureSnapshot(computedStyles) - Capture full DOM
Use Cases:
- Export page structure
- Offline analysis
- DOM diffing
Audits (Lighthouse Integration)
Purpose: Run automated audits
Key Commands:
Audits.enable() - Enable audits
Audits.getEncodingIssues() - Check encoding issues
LayerTree
Purpose: Inspect rendering layers
Key Commands:
LayerTree.enable() - Enable layer tracking
LayerTree.compositingReasons(layerId) - Get why layer created
Key Events:
LayerTree.layerTreeDidChange - Layers changed
Use Cases:
- Debug rendering performance
- Identify layer creation
- Optimize compositing
Other Domains
Browser
Purpose: Browser-level control
Key Commands:
Browser.getVersion() - Get browser info
Browser.getBrowserCommandLine() - Get launch args
Browser.setPermission(permission, setting, origin) - Set permissions
Browser.grantPermissions(permissions, origin) - Grant permissions
Permissions:
- geolocation, midi, notifications, push, camera, microphone, background-sync, sensors, accessibility-events, clipboard-read, clipboard-write, payment-handler
IO
Purpose: File I/O operations
Key Commands:
IO.read(handle, offset, size) - Read stream
IO.close(handle) - Close stream
Use Cases:
- Read large response bodies
- Process binary data
Media
Purpose: Inspect media players
Key Commands:
Media.enable() - Track media players
Key Events:
Media.playerPropertiesChanged - Player state changed
Media.playerEventsAdded - Player events
BackgroundService
Purpose: Track background services
Key Commands:
BackgroundService.startObserving(service) - Track service
Services:
- backgroundFetch, backgroundSync, pushMessaging, notifications, paymentHandler, periodicBackgroundSync
Domain Dependencies
Some domains depend on others and must be enabled in order:
Runtime (no dependencies)
↓
DOM (depends on Runtime)
↓
CSS (depends on DOM)
Network (no dependencies)
Page (depends on Runtime)
↓
Target (depends on Page)
Debugger (depends on Runtime)
Quick Command Reference
Most Common Commands
// Navigation
Page.navigate(url)
Page.reload()
// JavaScript Execution
Runtime.evaluate(expression)
// DOM Access
DOM.getDocument()
DOM.querySelector(nodeId, selector)
// Screenshots
Page.captureScreenshot(format, quality)
// Network Monitoring
Network.enable()
// Listen for Network.requestWillBeSent events
// Console Messages
// Listen for Runtime.consoleAPICalled events
// Cookies
Network.getCookies(urls)
Network.setCookie(...)
// Device Emulation
Emulation.setDeviceMetricsOverride(width, height, ...)
// Performance
Performance.getMetrics()
Tracing.start(categories)
Tracing.end()
Best Practices
- Enable domains before use: Always call
.enable() for stateful domains
- Handle events: Subscribe to events for real-time updates
- Clean up: Disable domains when done to reduce overhead
- Use sessions: Attach to specific targets for isolated debugging
- Handle errors: Implement proper error handling for command failures
- Version awareness: Check browser version for experimental API support
Additional Resources
1---2name: chrome-devtools-protocol-cdp-domains-reference3description: Complete reference of CDP domains and their capabilities for browser automation and debugging.4---5# Chrome DevTools Protocol (CDP) Domains Reference67Complete reference of CDP domains and their capabilities for browser automation and debugging.89## Overview1011CDP is organized into **47 domains**, each providing specific browser capabilities. Domains are grouped by functionality:1213- **Core** - Fundamental browser control14- **DOM & Styling** - Page structure and styling15- **Network & Fetch** - HTTP traffic management16- **Page & Navigation** - Page lifecycle control17- **Storage & Data** - Browser storage APIs18- **Performance & Profiling** - Metrics and analysis19- **Emulation & Simulation** - Device and network emulation20- **Worker & Service** - Background tasks21- **Developer Tools** - Debugging support2223---2425## Core Domains2627### Runtime28**Purpose:** Execute JavaScript, manage objects, handle promises2930**Key Commands:**31- `Runtime.evaluate(expression)` - Execute JavaScript32- `Runtime.callFunctionOn(functionDeclaration, objectId)` - Call function on object33- `Runtime.getProperties(objectId)` - Get object properties34- `Runtime.awaitPromise(promiseObjectId)` - Wait for promise resolution3536**Key Events:**37- `Runtime.consoleAPICalled` - Console message logged38- `Runtime.exceptionThrown` - Uncaught exception3940**Use Cases:**41- Execute custom JavaScript42- Access page data43- Monitor console output44- Handle exceptions4546---4748### Debugger49**Purpose:** JavaScript debugging, breakpoints, stack traces5051**Key Commands:**52- `Debugger.enable()` - Enable debugger53- `Debugger.setBreakpoint(location)` - Set breakpoint54- `Debugger.pause()` - Pause execution55- `Debugger.resume()` - Resume execution56- `Debugger.stepOver/stepInto/stepOut()` - Step through code5758**Key Events:**59- `Debugger.paused` - Execution paused60- `Debugger.resumed` - Execution resumed61- `Debugger.scriptParsed` - Script loaded6263**Use Cases:**64- Debug JavaScript errors65- Inspect call stacks66- Set conditional breakpoints67- Source map support6869---7071### Console (Deprecated - Use Runtime/Log)72**Purpose:** Legacy console message access7374**Note:** Use `Runtime.consoleAPICalled` event instead for new implementations.7576---7778## DOM & Styling Domains7980### DOM81**Purpose:** Access and manipulate DOM tree8283**Key Commands:**84- `DOM.getDocument()` - Get root document node85- `DOM.querySelector(nodeId, selector)` - Query selector86- `DOM.querySelectorAll(nodeId, selector)` - Query all87- `DOM.getAttributes(nodeId)` - Get element attributes88- `DOM.setOuterHTML(nodeId, outerHTML)` - Replace element89- `DOM.getBoxModel(nodeId)` - Get element layout box90- `DOM.focus(nodeId)` - Focus element9192**Key Events:**93- `DOM.documentUpdated` - Document changed94- `DOM.setChildNodes` - Child nodes updated9596**Use Cases:**97- Navigate DOM tree98- Query elements99- Modify DOM structure100- Get element positions101102---103104### CSS105**Purpose:** Inspect and modify CSS styles106107**Key Commands:**108- `CSS.enable()` - Enable CSS domain109- `CSS.getComputedStyleForNode(nodeId)` - Get computed styles110- `CSS.getInlineStylesForNode(nodeId)` - Get inline styles111- `CSS.getMatchedStylesForNode(nodeId)` - Get matched CSS rules112- `CSS.setStyleTexts(edits)` - Modify styles113114**Key Events:**115- `CSS.styleSheetAdded` - Stylesheet added116- `CSS.styleSheetChanged` - Stylesheet modified117118**Use Cases:**119- Inspect element styles120- Debug CSS issues121- Modify styles dynamically122- Extract stylesheet data123124---125126### Accessibility127**Purpose:** Access accessibility tree128129**Key Commands:**130- `Accessibility.enable()` - Enable accessibility131- `Accessibility.getFullAXTree()` - Get complete AX tree132- `Accessibility.getPartialAXTree(nodeId)` - Get node subtree133- `Accessibility.queryAXTree(nodeId, role, name)` - Query AX tree134135**Use Cases:**136- Accessibility testing137- Screen reader simulation138- ARIA attribute inspection139- AX tree analysis140141---142143## Network & Fetch Domains144145### Network146**Purpose:** Monitor and control HTTP traffic147148**Key Commands:**149- `Network.enable()` - Enable network tracking150- `Network.setCacheDisabled(cacheDisabled)` - Disable cache151- `Network.setExtraHTTPHeaders(headers)` - Add custom headers152- `Network.getCookies(urls)` - Get cookies153- `Network.setCookie(name, value, domain)` - Set cookie154- `Network.getResponseBody(requestId)` - Get response body155- `Network.emulateNetworkConditions(offline, latency, downloadThroughput, uploadThroughput)` - Throttle network156157**Key Events:**158- `Network.requestWillBeSent` - Request starting159- `Network.responseReceived` - Response received160- `Network.loadingFinished` - Request completed161- `Network.loadingFailed` - Request failed162163**Use Cases:**164- Monitor API calls165- Intercept requests166- Analyze response data167- Simulate slow networks168- Manage cookies169170---171172### Fetch173**Purpose:** Intercept and modify network requests174175**Key Commands:**176- `Fetch.enable(patterns)` - Enable request interception177- `Fetch.continueRequest(requestId, url, method, headers)` - Continue/modify request178- `Fetch.fulfillRequest(requestId, responseCode, headers, body)` - Mock response179- `Fetch.failRequest(requestId, errorReason)` - Fail request180181**Key Events:**182- `Fetch.requestPaused` - Request intercepted183184**Use Cases:**185- Mock API responses186- Block requests187- Modify request/response188- Test error scenarios189190---191192## Page & Navigation Domains193194### Page195**Purpose:** Control page lifecycle and navigation196197**Key Commands:**198- `Page.enable()` - Enable page domain199- `Page.navigate(url)` - Navigate to URL200- `Page.reload(ignoreCache)` - Reload page201- `Page.goBack()/goForward()` - Navigate history202- `Page.captureScreenshot(format, quality)` - Take screenshot203- `Page.printToPDF(landscape, displayHeaderFooter)` - Generate PDF204- `Page.getLayoutMetrics()` - Get page dimensions205- `Page.createIsolatedWorld(frameId)` - Create isolated context206- `Page.handleJavaScriptDialog(accept, promptText)` - Handle alerts/confirms207208**Key Events:**209- `Page.loadEventFired` - Page loaded210- `Page.domContentEventFired` - DOM ready211- `Page.frameNavigated` - Frame navigated212- `Page.javascriptDialogOpening` - Alert/confirm shown213214**Use Cases:**215- Navigate pages216- Capture screenshots217- Generate PDFs218- Handle popups219- Monitor page lifecycle220221---222223### Target224**Purpose:** Manage browser targets (tabs, workers, frames)225226**Key Commands:**227- `Target.getTargets()` - List all targets228- `Target.createTarget(url)` - Open new tab229- `Target.closeTarget(targetId)` - Close tab230- `Target.attachToTarget(targetId)` - Attach debugger231- `Target.detachFromTarget(sessionId)` - Detach debugger232- `Target.setDiscoverTargets(discover)` - Auto-discover targets233234**Key Events:**235- `Target.targetCreated` - New target created236- `Target.targetDestroyed` - Target closed237- `Target.targetInfoChanged` - Target updated238239**Use Cases:**240- Multi-tab automation241- Service worker debugging242- Frame inspection243- Extension debugging244245---246247### Input248**Purpose:** Simulate user input249250**Key Commands:**251- `Input.dispatchKeyEvent(type, key, code)` - Keyboard input252- `Input.dispatchMouseEvent(type, x, y, button)` - Mouse input253- `Input.dispatchTouchEvent(type, touchPoints)` - Touch input254- `Input.synthesizePinchGesture(x, y, scaleFactor)` - Pinch gesture255- `Input.synthesizeScrollGesture(x, y, xDistance, yDistance)` - Scroll256257**Use Cases:**258- Simulate clicks259- Type text260- Drag and drop261- Touch gestures262- Scroll pages263264---265266## Storage & Data Domains267268### Storage269**Purpose:** Manage browser storage270271**Key Commands:**272- `Storage.getCookies(browserContextId)` - Get cookies273- `Storage.setCookies(cookies)` - Set cookies274- `Storage.clearCookies(browserContextId)` - Clear cookies275- `Storage.clearDataForOrigin(origin, storageTypes)` - Clear storage276- `Storage.getUsageAndQuota(origin)` - Get storage usage277278**Storage Types:**279- appcache, cookies, file_systems, indexeddb, local_storage, shader_cache, websql, service_workers, cache_storage280281**Use Cases:**282- Cookie management283- Clear browser data284- Inspect storage usage285- Test quota limits286287---288289### DOMStorage290**Purpose:** Access localStorage/sessionStorage291292**Key Commands:**293- `DOMStorage.enable()` - Enable storage tracking294- `DOMStorage.getDOMStorageItems(storageId)` - Get items295- `DOMStorage.setDOMStorageItem(storageId, key, value)` - Set item296- `DOMStorage.removeDOMStorageItem(storageId, key)` - Remove item297298**Key Events:**299- `DOMStorage.domStorageItemsCleared` - Storage cleared300- `DOMStorage.domStorageItemAdded/Updated/Removed` - Item changed301302---303304### IndexedDB305**Purpose:** Query IndexedDB databases306307**Key Commands:**308- `IndexedDB.requestDatabaseNames(securityOrigin)` - List databases309- `IndexedDB.requestDatabase(securityOrigin, databaseName)` - Get DB structure310- `IndexedDB.requestData(securityOrigin, databaseName, objectStoreName)` - Query data311312**Use Cases:**313- Inspect IndexedDB data314- Debug database issues315- Extract stored data316317---318319### CacheStorage320**Purpose:** Manage Cache API321322**Key Commands:**323- `CacheStorage.requestCacheNames(securityOrigin)` - List caches324- `CacheStorage.requestCachedResponses(cacheId, securityOrigin)` - List cached responses325- `CacheStorage.deleteCache(cacheId)` - Delete cache326327**Use Cases:**328- Service worker cache inspection329- Offline functionality testing330331---332333## Performance & Profiling Domains334335### Performance336**Purpose:** Collect performance metrics337338**Key Commands:**339- `Performance.enable()` - Enable performance tracking340- `Performance.disable()` - Disable tracking341- `Performance.getMetrics()` - Get current metrics342343**Metrics:**344- Timestamp, Documents, Frames, JSEventListeners, Nodes, LayoutCount, RecalcStyleCount, LayoutDuration, RecalcStyleDuration, ScriptDuration, TaskDuration, JSHeapUsedSize, JSHeapTotalSize345346**Use Cases:**347- Monitor page metrics348- Track memory usage349- Measure render times350351---352353### PerformanceTimeline354**Purpose:** Access Performance Timeline API355356**Key Commands:**357- `PerformanceTimeline.enable(eventTypes)` - Subscribe to events358359**Event Types:**360- mark, measure, navigation, resource, longtask, paint, layout-shift361362**Key Events:**363- `PerformanceTimeline.timelineEventAdded` - New performance entry364365---366367### Tracing368**Purpose:** Record Chrome trace369370**Key Commands:**371- `Tracing.start(categories, options)` - Start recording372- `Tracing.end()` - Stop recording373- `Tracing.requestMemoryDump()` - Capture memory snapshot374375**Trace Categories:**376- blink, cc, devtools, gpu, loading, navigation, rendering, v8, disabled-by-default-*377378**Key Events:**379- `Tracing.dataCollected` - Trace chunk received380- `Tracing.tracingComplete` - Recording finished381382**Use Cases:**383- Deep performance analysis384- Frame rendering profiling385- CPU flame graphs386- Memory profiling387388---389390### Profiler391**Purpose:** CPU profiling392393**Key Commands:**394- `Profiler.enable()` - Enable profiler395- `Profiler.start()` - Start CPU profiling396- `Profiler.stop()` - Stop and get profile397398**Use Cases:**399- Find CPU bottlenecks400- Optimize JavaScript401- Generate flame graphs402403---404405### HeapProfiler (via Memory domain)406**Purpose:** Memory profiling407408**Key Commands:**409- `Memory.getDOMCounters()` - Get DOM object counts410- `Memory.prepareForLeakDetection()` - Prepare leak detection411- `Memory.forciblyPurgeJavaScriptMemory()` - Force GC412- `Memory.setPressureNotificationsSuppressed(suppressed)` - Control memory warnings413- `Memory.simulatePressureNotification(level)` - Simulate memory pressure414415**Use Cases:**416- Detect memory leaks417- Analyze heap snapshots418- Monitor object counts419420---421422## Emulation & Simulation Domains423424### Emulation425**Purpose:** Emulate device conditions426427**Key Commands:**428- `Emulation.setDeviceMetricsOverride(width, height, deviceScaleFactor, mobile)` - Emulate device429- `Emulation.setGeolocationOverride(latitude, longitude, accuracy)` - Fake location430- `Emulation.setEmulatedMedia(media, features)` - Emulate media type431- `Emulation.setTimezoneOverride(timezoneId)` - Override timezone432- `Emulation.setLocaleOverride(locale)` - Override language433- `Emulation.setUserAgentOverride(userAgent)` - Change user agent434435**Use Cases:**436- Mobile device testing437- Geolocation testing438- Print media emulation439- Timezone/locale testing440441---442443### DeviceOrientation444**Purpose:** Simulate device orientation445446**Key Commands:**447- `DeviceOrientation.setDeviceOrientationOverride(alpha, beta, gamma)` - Set orientation448449**Use Cases:**450- Test accelerometer features451- Orientation-dependent layouts452453---454455## Worker & Service Domains456457### ServiceWorker458**Purpose:** Manage service workers459460**Key Commands:**461- `ServiceWorker.enable()` - Enable tracking462- `ServiceWorker.unregister(scopeURL)` - Unregister worker463- `ServiceWorker.startWorker(scopeURL)` - Start worker464- `ServiceWorker.stopWorker(versionId)` - Stop worker465- `ServiceWorker.inspectWorker(versionId)` - Debug worker466467**Key Events:**468- `ServiceWorker.workerRegistrationUpdated` - Registration changed469- `ServiceWorker.workerVersionUpdated` - Version updated470471---472473### WebAuthn474**Purpose:** Simulate WebAuthn/FIDO2475476**Key Commands:**477- `WebAuthn.enable()` - Enable virtual authenticators478- `WebAuthn.addVirtualAuthenticator(options)` - Add virtual device479- `WebAuthn.removeVirtualAuthenticator(authenticatorId)` - Remove device480- `WebAuthn.addCredential(authenticatorId, credential)` - Add credential481482**Use Cases:**483- Test WebAuthn flows484- Simulate biometric auth485- Test security keys486487---488489## Developer Tools Support490491### Inspector492**Purpose:** Protocol-level debugging493494**Key Events:**495- `Inspector.detached` - Debugger disconnected496- `Inspector.targetCrashed` - Target crashed497498---499500### Log501**Purpose:** Collect browser logs502503**Key Commands:**504- `Log.enable()` - Enable log collection505- `Log.clear()` - Clear logs506507**Key Events:**508- `Log.entryAdded` - New log entry509510**Use Cases:**511- Collect console logs512- Monitor violations513- Track deprecations514515---516517### DOMDebugger518**Purpose:** DOM-level debugging519520**Key Commands:**521- `DOMDebugger.setDOMBreakpoint(nodeId, type)` - Break on DOM changes522- `DOMDebugger.setEventListenerBreakpoint(eventName)` - Break on event523- `DOMDebugger.setXHRBreakpoint(url)` - Break on XHR524525**Breakpoint Types:**526- subtree-modified, attribute-modified, node-removed527528---529530### DOMSnapshot531**Purpose:** Capture complete DOM snapshot532533**Key Commands:**534- `DOMSnapshot.captureSnapshot(computedStyles)` - Capture full DOM535536**Use Cases:**537- Export page structure538- Offline analysis539- DOM diffing540541---542543### Audits (Lighthouse Integration)544**Purpose:** Run automated audits545546**Key Commands:**547- `Audits.enable()` - Enable audits548- `Audits.getEncodingIssues()` - Check encoding issues549550---551552### LayerTree553**Purpose:** Inspect rendering layers554555**Key Commands:**556- `LayerTree.enable()` - Enable layer tracking557- `LayerTree.compositingReasons(layerId)` - Get why layer created558559**Key Events:**560- `LayerTree.layerTreeDidChange` - Layers changed561562**Use Cases:**563- Debug rendering performance564- Identify layer creation565- Optimize compositing566567---568569## Other Domains570571### Browser572**Purpose:** Browser-level control573574**Key Commands:**575- `Browser.getVersion()` - Get browser info576- `Browser.getBrowserCommandLine()` - Get launch args577- `Browser.setPermission(permission, setting, origin)` - Set permissions578- `Browser.grantPermissions(permissions, origin)` - Grant permissions579580**Permissions:**581- geolocation, midi, notifications, push, camera, microphone, background-sync, sensors, accessibility-events, clipboard-read, clipboard-write, payment-handler582583---584585### IO586**Purpose:** File I/O operations587588**Key Commands:**589- `IO.read(handle, offset, size)` - Read stream590- `IO.close(handle)` - Close stream591592**Use Cases:**593- Read large response bodies594- Process binary data595596---597598### Media599**Purpose:** Inspect media players600601**Key Commands:**602- `Media.enable()` - Track media players603604**Key Events:**605- `Media.playerPropertiesChanged` - Player state changed606- `Media.playerEventsAdded` - Player events607608---609610### BackgroundService611**Purpose:** Track background services612613**Key Commands:**614- `BackgroundService.startObserving(service)` - Track service615616**Services:**617- backgroundFetch, backgroundSync, pushMessaging, notifications, paymentHandler, periodicBackgroundSync618619---620621## Domain Dependencies622623Some domains depend on others and must be enabled in order:624625```626Runtime (no dependencies)627 ↓628DOM (depends on Runtime)629 ↓630CSS (depends on DOM)631632Network (no dependencies)633634Page (depends on Runtime)635 ↓636Target (depends on Page)637638Debugger (depends on Runtime)639```640641## Quick Command Reference642643### Most Common Commands644645```javascript646// Navigation647Page.navigate(url)648Page.reload()649650// JavaScript Execution651Runtime.evaluate(expression)652653// DOM Access654DOM.getDocument()655DOM.querySelector(nodeId, selector)656657// Screenshots658Page.captureScreenshot(format, quality)659660// Network Monitoring661Network.enable()662// Listen for Network.requestWillBeSent events663664// Console Messages665// Listen for Runtime.consoleAPICalled events666667// Cookies668Network.getCookies(urls)669Network.setCookie(...)670671// Device Emulation672Emulation.setDeviceMetricsOverride(width, height, ...)673674// Performance675Performance.getMetrics()676Tracing.start(categories)677Tracing.end()678```679680---681682## Best Practices6836841. **Enable domains before use:** Always call `.enable()` for stateful domains6852. **Handle events:** Subscribe to events for real-time updates6863. **Clean up:** Disable domains when done to reduce overhead6874. **Use sessions:** Attach to specific targets for isolated debugging6885. **Handle errors:** Implement proper error handling for command failures6896. **Version awareness:** Check browser version for experimental API support690691---692693## Additional Resources694695- [Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/) - Interactive domain browser696- [Protocol JSON](https://chromedevtools.github.io/devtools-protocol/tot/json) - Machine-readable specification697- [Getting Started with CDP](https://github.com/aslushnikov/getting-started-with-cdp)698- [devtools-protocol NPM](https://www.npmjs.com/package/devtools-protocol) - TypeScript definitions