Add delay function
This commit is contained in:
parent
f750df107e
commit
c87955088d
11
index.js
11
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();
|
||||
|
Loading…
Reference in New Issue
Block a user