Skip to content

Instantly share code, notes, and snippets.

@zoutepopcorn
Created October 31, 2022 09:30
Show Gist options
  • Save zoutepopcorn/777facc780611a0bc643157bc2efdc96 to your computer and use it in GitHub Desktop.
Save zoutepopcorn/777facc780611a0bc643157bc2efdc96 to your computer and use it in GitHub Desktop.
import puppeteer from 'puppeteer';
let page, context;
const browser = await puppeteer.launch({
headless: false
});
const sleep = (time) => {
return new Promise((resolve) => {
setTimeout(resolve, time);
});
}
const start = async () => {
context = await browser.createIncognitoBrowserContext();
page = await context.newPage();
await page.goto('cookie.html');
await sleep(3000);
await page.close();
context = await browser.createIncognitoBrowserContext();
page = await context.newPage();
await page.goto('cookie.html');
await sleep(5000);
console.log(context.isIncognito());
}
start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment