29 lines
711 B
JavaScript
29 lines
711 B
JavaScript
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();
|
|
|
|
await page.setViewport({width: 1080, height: 1024});
|
|
|
|
await page.goto('https://www.ohlq.com/search-results?query=weller&contenttype=Product');
|
|
|
|
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();
|
|
})();
|