You want to know about Puppeteer's page.evaluate() method! pPage.evaluate() is a powerful function in Puppeteer that allows you to execute capricious JavaScript code on a web page. It takes a function as an argument, which will be all be executed in the context of the page. The function you pass to page.evaluate() has access to the entire DOM and is able to perform any actions that a user would be able to do, such as clicking elements, filling out forms, or even retrieving data from the page. This method returns a Promise that resolves to the value returned by the function. Here is an example: const puppeteer = require('puppeteer'); const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('(link unavailable)'); const result = await page.evaluate(() => document.querySelector('#my-element').textContent); console.log(result); // prints the text content of the element with id "my-element" In this example, the page.evaluate() method is used to retrieve the text content of an element with the id "my-element" on the page. And remember page.evaluate() runs in the context of the page, so any changes made to the page within the function will be persisted on the page.