I am using these two methods to get the text of an HTML element. For example:
let elHandle = await page.$("#product");
let productName = await elHandle.evaluate(element => {
return element.textContent;
});
And
let productName = await page.$eval("#product", element => {
return element.textContent;
});
In both examples I pass the "pageFunction" as parameter to both methods. But what is a page function in puppeteer?
Edit: I should add that the following passage is given in the documentation but I don't understand what it means:
pageFunction <function|string> Function to be evaluated in the page context
Edit: typo!