1const context = await browser.createIncognitoBrowserContext()
2const page = await context.newPage()
3page.setJavaScriptEnabled(false)
4
1const context = await browser.defaultBrowserContext();
2const page = await context.newPage();
1using (Browser browser = await Puppeteer.LaunchAsync(options))
2{
3 // create the async context
4 var context = await browser.CreateIncognitoBrowserContextAsync();
5
6 // get the page created by default when launch async ran and close it whilst keeping the browser active
7 var browserPages = await browser.PagesAsync();
8 await browserPages[0].CloseAsync();
9
10 // create a new page using the incognito context
11 using (Page page = await context.NewPageAsync())
12 {
13 // do something
14 }
15}
16