node open incognito mode code example

Example 1: pupetter create incognitor browser

const context = await browser.createIncognitoBrowserContext()
const page = await context.newPage()
page.setJavaScriptEnabled(false)

Example 2: pupetter create incognitor browser

using (Browser browser = await Puppeteer.LaunchAsync(options))
{
     // create the async context 
    var context = await browser.CreateIncognitoBrowserContextAsync();

    // get the page created by default when launch async ran and close it whilst keeping the browser active
    var browserPages = await browser.PagesAsync();
    await browserPages[0].CloseAsync();

    // create a new page using the incognito context
    using (Page page = await context.NewPageAsync())
    {
        // do something 
    }
}