How to open DevTools for a Page in Puppeteer?

Puppeteer

To open DevTools for a page in Puppeteer, use the new Page.openDevTools() method. It calls the DevTools interface for the target page and returns a Page that points to the DevTools instance.

const devtools = await page.openDevTools();
// devtools is a Page instance representing the DevTools UI for the page