page.evaluate

Accessing browser variables

By using page.evaluate, we can access browser variables such as window, document, and navigation, like so

const location = await page.evaluate(() => window.location);

Using the clipboard in puppeteer headless