I'm having trouble with the pupetter evaluate function. Im declaring a variable outside the function and pass it through. Inside the function it does not work and just makes it undefinied. Any help is apreciated!
let fname = lines[Math.floor(Math.random() * lines.length)].toString()
let lname = lines[Math.floor(Math.random() * lines.length)].toString()
await page.evaluate((fname, lname) => {
document.getElementById('first-name-su').value = fname;
document.getElementById('last-name-su').value = lname;
}
thats not the full code, just the snipbit of what is not working