const puppeteer = require('puppeteer'); const path = require('path') /* for (let i=0; i name.innerText, getXpath); const resource = resourcetitle.trim(); console.log(resource); await page.screenshot({path: `${resource}_1.png`, fullPage:true, headless:false}); const hrefs = await page.$$eval('a', as => as.map(a => a.href)); var links = Object.entries(hrefs); links.forEach(([key, value]) => { var link = value; if (link.includes("activities")) { activity.push(link); } }); uniqueLinks = [...new Set(activity)]; for (const link of uniqueLinks) { num = num+1 const newlink = link+uid; // console.log(newlink) screenshots(newlink, resource, num); } await browser.close(); } async function screenshots(newlink, resource, num) { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.setViewport({ width: 390, height: 844 }) await page.goto(newlink); await page.screenshot({path: `${resource}_${num}.png`, fullPage: true, headless: false}); await browser.close(); } courseOverview();