diff --git a/index.js b/index.js index f72c8a9..d628c20 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,11 @@ const puppeteer = require('puppeteer'); +function delay(time) { + return new Promise(function(resolve) { + setTimeout(resolve, time); + }); +} + (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); @@ -11,6 +17,11 @@ const puppeteer = require('puppeteer'); const ageButton = await page.$("button[data-test='ageVerificationButton']"); await ageButton.click(); + delay(8000); + + const firstButton = await page.$("span .button"); + await firstButton.click(); + await page.screenshot({path: 'screenshot.jpg'}); await browser.close();