Puppeteer Launch Incognito

The best way to accomplish your goal is to launch the browser directly into incognito mode by passing the --incognito flag to puppeteer.launch():

const browser = await puppeteer.launch({
  args: [
    '--incognito',
  ],
});

Alternatively, you can create a new incognito browser context after launching the browser using browser.createIncognitoBrowserContext():

const browser = await puppeteer.launch();
const context = await browser.createIncognitoBrowserContext();

You can check whether a browser context is incognito using browserContext.isIncognito():

if (context.isIncognito()) { /* ... */ }

the solutions above didn't work for me:

an incognito window is created, but then when the new page is created, it is no longer incognito.

The solution that worked for me was:

const browser = await puppeteer.launch();
const context = await browser.createIncognitoBrowserContext();
const page = await context.newPage();

then you can use page and it's an incognito page