KumologicaHQ / kumologica-support

3 stars 0 forks source link

Puppeteer Custom Scripts #11

Open sparkyrider opened 3 years ago

sparkyrider commented 3 years ago

It would be amazing to have the ability to customize the Puppeteer script that runs. For example, we have some sites that require us to Load the page, add to local storage a cookie (to accept TOS to avoid pop-ups), and then load the page again and then screenshot/create PDF/PNG.

(async () => { const browser = await puppeteer.launch(); const page = await browser.newPage();

await page.goto('http://localhost:8080/');

await page.evaluate(() => { localStorage.setItem('token', 'example-token'); });

await page.goto('http://localhost:8080/');