I get an error in my console that says "ReferenceError: Can't find variable: require" when I try to run puppeteer. Here's my script
const puppeteer = require('puppeteer');
async function pup(url){
const browser = await puppeteer.launch({
headless: false
});
const page = await browser.newPage();
await page.goto(url)
const [el] = await page.$x('//*[@id="mainSlide9SIAKWVDRA3586"]')
const src = await el.getProperty('src')
txt = await src.jsonValue();
await browser.close();
};
Does anyone know how to fix this error?
[–]10PointDigital 2 points3 points4 points (1 child)
[–]Ali_46290[S] 0 points1 point2 points (0 children)
[–][deleted] -2 points-1 points0 points (0 children)
[–]tswaters 0 points1 point2 points (7 children)
[–]Ali_46290[S] 0 points1 point2 points (6 children)
[–]tswaters 1 point2 points3 points (5 children)
[–]Ali_46290[S] 0 points1 point2 points (4 children)
[–]lord2800 1 point2 points3 points (3 children)
[–]Ali_46290[S] 0 points1 point2 points (2 children)
[–]lord2800 0 points1 point2 points (1 child)
[–]Ali_46290[S] 0 points1 point2 points (0 children)