← Back to context

Comment by giorgioz

3 hours ago

Can anyone tell me some use cases for CDP commands?

In which situation is preferable to use CDP commands over Puppeteer?

Tools like Playwright and Puppeteer are abstractions on top of CDP. The other use case is when these frameworks don’t expose or don’t use a CDP command you need (often they hide some parameters for cross browser compatibility).

Webdriver BiDi is a future cross browser replacement:

https://www.w3.org/TR/webdriver-bidi/

  • Bidi’s not a viable replacement for some use-cases e.g. setting headers for just the main origin as it’s add header command adds the header to all requests potentially causing CORS issues

Some things you can only do via CDP — last time I looked adding a HTTP header to requests that match a certain URL was only possible via CDP