Created
October 31, 2022 09:30
-
-
Save zoutepopcorn/777facc780611a0bc643157bc2efdc96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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