I'm receiving the following error:
ReferenceError: processElement is not defined
When trying to invoke this regular function from my main async function.
I'm using Chrome Puppeteer to get information about page elements. Puppeteer wants to run in an async function, understandably, but I need to do some processing in other functions, possibly recursively.
My basic structure is this:
function processElement(element, index) {
// element processing here, may ultimately need recursion.
}
function async main() {
// puppeteer stuff
const elements = document.querySelectorAll('p');
elements.forEach((element, index) => {
processElement(element, index);
}
}
main();
Thanks for any help! I'm new to the whole async/await paradigm.