In this example code, when it reads the array contactList and j it says both are not defined, what is wrong?
const { join } = require('path');
const puppeteer = require('puppeteer');
(async () => {
// 1. Launch the browser
const browser = await puppeteer.launch({
"args": [
'--remote-debugging-port=9222'
],
"defaultViewport": {
"height": 1080,
"width": 1920
},
"headless": false
});
// 2. Open a new page
const page = await browser.newPage();
// 3. Navigate to URL
await page.goto('https://');
await new Promise(r => setTimeout(r, 10000));
console.log('Ready');
var contactList = ['cesar','gab','777','81411579','34353'];
var fLen = contactList.length;
var j = 0;
for (i = 0; i < fLen; i++) {
await page.evaluate(() => {
function searchContact(contact_name = "") {
//search = document.querySelector('#side > div._1Ra05 > div > label > div > div._1awRl.copyable-text.selectable-text');
search = document.querySelector('#side > div._1Ra05 > div > label > div > div._1awRl.copyable-text.selectable-text');
}
j++;
searchContact(contactList[j]);
}
}