ChromeDevelopmentToolsProtocol

Manages interactions with the Chrome DevTools Protocol for Chrome and Edge browsers. Allows sending commands and setting up event listeners via the protocol.

Classes

ChromeDevelopmentToolsProtocol

Methods

getRawClient() → {Object}

Retrieves the raw client for the DevTools Protocol.
Throws:
Throws an error if the browser is not supported.
Type
Error
Returns:
The raw DevTools Protocol client.
Type: 
Object
Example
const cdpClient = commands.cdp.getRawClient();

(async) on(event, f)

Sets up an event listener for a specific DevTools Protocol event.
Parameters:
NameTypeDescription
eventstringThe name of the event to listen for.
ffunctionThe callback function to execute when the event is triggered.
Throws:
Throws an error if the browser is not supported or if setting the listener fails.
Type
Error

(async) send(command, arguments_) → {Promise.<void>}

Sends a command to the DevTools Protocol.
Parameters:
NameTypeDescription
commandstringThe DevTools Protocol command to send.
arguments_ObjectThe arguments for the command.
Throws:
Throws an error if the browser is not supported or if the command fails.
Type
Error
Returns:
A promise that resolves when the command has been sent.
Type: 
Promise.<void>
Example
await commands.cdp.send('');

(async) sendAndGet(command, arguments_) → {Promise.<Object>}

Sends a command to the DevTools Protocol and returns the result.
Parameters:
NameTypeDescription
commandstringThe DevTools Protocol command to send.
arguments_ObjectThe arguments for the command.
Throws:
Throws an error if the browser is not supported or if the command fails.
Type
Error
Returns:
The result of the command execution.
Type: 
Promise.<Object>
Example
const domCounters = await commands.cdp.sendAndGet('Memory.getDOMCounters');