How to Take a Screenshot Using Puppeteer
Taking a screenshot using Puppeteer is a simple process. Once you have created the Puppeteer page
object, you can use the screenshot()
method to save a screenshot of the page.
Here is an example of how to save a screenshot as screenshot.jpg
:
1 | const page = await browser.newPage(); |
To capture the entire page, you can add the fullPage
option to the screenshot()
method:
1 | await page.screenshot({ |
For a more comprehensive understanding of Puppeteer, you may refer to my full Puppeteer tutorial.
tags: [“puppeteer”, “screenshot”, “web development”, “browser automation”]