Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallUse Puppeteer’s page-scoped CDP session: call await page.createCDPSession(), then send commands with await client.send('Domain.command', params). The returned promise resolves with the protocol response; subscribe to protocol events with client.on(). Detach the session when you are finished.
Send a CDP command from Puppeteer
This runnable Node.js example opens a page, attaches a Chrome DevTools Protocol (CDP) session, enables the Animation domain, listens for an event, reads a value, changes it, then detaches and closes the browser.
As an Amazon Associate I earn from qualifying purchases.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
const client = await page.createCDPSession();
try {
await client.send('Animation.enable');
client.on('Animation.animationCreated', event => {
console.log('Animation created:', event);
});
const { playbackRate } = await client.send('Animation.getPlaybackRate');
console.log('Playback rate:', playbackRate);
await client.send('Animation.setPlaybackRate', {
playbackRate: playbackRate / 2,
});
} finally {
await client.detach();
}
} finally {
await browser.close();
}
Run it in a Node.js project with Puppeteer installed, using a package setup that supports ES modules (for example, a .mjs file). The try/finally blocks ensure the session is detached and the browser is closed even if a command fails. The sample uses the Animation domain; replace its methods and event with the ones required for your task.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Understand commands, results, and events
CDP groups methods and events into domains such as Page, Network, Runtime, and Animation. A command name is a string in the form Domain.method. Pass a parameter object when the method requires arguments; omit it for methods that take none.
#1 Best Overall
await client.send('Animation.enable')enables the domain so its events can be observed.await client.send('Animation.setPlaybackRate', { playbackRate: 0.5 })sends a method with parameters.await client.send('Animation.getPlaybackRate')resolves to the command’s protocol response object, which the example destructures to readplaybackRate.client.on('Animation.animationCreated', handler)registers an event listener. Use the event name associated with the domain and command you need.
Use the protocol mapping and documentation for your installed Puppeteer release to check method names and parameter shapes. Puppeteer can provide type checking for mapped methods in TypeScript; an unknown or unsupported method may not be caught until runtime.
Choose the right session target
Attach to a page
For commands that concern a page, use await page.createCDPSession(). It returns a CDPSession attached to that page.
Attach to another target
Use target.createCDPSession() when you need a session attached to a CDP target rather than the page API’s context. Targets can represent pages, frames, or workers, so target-level attachment can address contexts outside the page you are automating.
Free tools Windows power users keep installed
One-click scans. No signup required.
Do not use page.target() as the route to a session: Puppeteer marks that method obsolete and directs users to Page.createCDPSession().
Rank #3
Manage the session lifecycle and errors
Keep the session attached while you need to send commands or receive events. Once detached, it cannot send messages or emit events; create a new session if you need to resume protocol work. Await each send() call so command failures can be handled in the surrounding control flow.
For Puppeteer 25.12.0, the documented ConnectOptions default for protocolTimeout is 180,000 milliseconds per CDP call. This setting is version-sensitive; check the API reference for the Puppeteer release in your project before relying on that default or changing it.
Check compatibility before depending on a method
Puppeteer releases are paired with specific browser releases to preserve protocol compatibility. Puppeteer uses CDP by default when automating Chrome and also supports WebDriver BiDi. The CDP tip-of-tree reference changes frequently and may break; the stable 1.3 protocol is a smaller subset tagged at Chrome 64. Confirm that the command exists in the browser build you actually run and matches the protocol mapping for your Puppeteer version.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →- Prefer Puppeteer’s higher-level API when it already performs the operation you need; direct CDP is useful for lower-level Chrome capabilities not exposed there.
- Use CDP when Chrome-specific protocol functionality is required. If cross-browser automation matters, evaluate WebDriver BiDi and verify feature differences rather than assuming the same command is portable.
- Align Puppeteer and browser versions, especially when using experimental or tip-of-tree methods.
Troubleshoot common CDP problems
- “Method wasn’t found” or an equivalent protocol error: the method may not be available in that browser version, may be experimental, or may be misspelled. Check the domain and method against the installed browser’s protocol support and the matching Puppeteer references.
- Parameters are rejected: verify the command’s required fields, value types, and nesting. Send a parameter object as the second argument to
send(); do not assume similarly named methods share parameters. - No event arrives: check that you enabled the relevant domain when required, registered the listener before the action that triggers the event, and used the exact event name. Confirm the session is still attached.
- Calls fail after detaching: a detached session cannot be reused. Create a new session with the appropriate page or target.
- A call takes too long or times out: the command may be waiting on browser work or the protocol timeout. Check the installed Puppeteer release’s timeout configuration and whether the page or target is still responsive.
- Works with one Chrome/Puppeteer pair but not another: protocol support is version-dependent. Check the exact browser and Puppeteer versions and avoid assuming that tip-of-tree commands are stable.
Or skip the browser setup
If your goal is simply to get a website screenshot, ScreenshotNeo provides a one-request API rather than a Puppeteer/CDP browser workflow. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.
Sign up for 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Can Puppeteer send CDP commands to Firefox?
The CDP session approach described here is for Chrome’s DevTools Protocol. Puppeteer also supports WebDriver BiDi; check the browser and feature support when cross-browser automation is required.
Can I reuse a CDP session after calling detach()?
No. A detached session cannot send messages or emit events; create a new session for further protocol work.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




