Both Puppeteer and Selenium can capture website screenshots. Choose Puppeteer when your automation is JavaScript-centric and its page- and element-screenshot APIs fit your needs. Choose Selenium when your team depends on its language bindings, native WebDriver control, local or remote browser sessions, or existing WebDriver stack. For either, verify full-page behavior in your actual browser, binding, and version before building around it.
How to choose between Puppeteer and Selenium
| Need | Better starting point | Why |
|---|---|---|
| JavaScript-first automation with direct page and element screenshot methods | Puppeteer | It is a JavaScript library with high-level screenshot APIs. |
| Existing automation in a language supported by Selenium bindings | Selenium | Selenium provides language bindings and browser-control implementations. |
| Local or remote browser sessions through WebDriver | Selenium | WebDriver drives browsers locally or remotely and is a W3C Recommendation. |
| Chrome or Firefox controlled through DevTools Protocol or WebDriver BiDi | Puppeteer | Those are the protocols named in Puppeteer’s description; confirm support in your installed version. |
| A guaranteed identical full-document screenshot across browsers | Neither without a proof of concept | Screenshot scope and options can vary by browser, protocol, and language binding. |
There is no documented head-to-head benchmark here establishing a universal winner for speed, fidelity, reliability, or cost. Base the choice on your team’s codebase and required browser environment, then test the precise capture behavior you will deploy.
As an Amazon Associate I earn from qualifying purchases.
Take a page screenshot with Puppeteer
Puppeteer runs headless by default and can also run headful. Its documented workflow is to launch a browser, create a page, navigate, capture, and close the browser. Install Puppeteer in your Node.js project with npm install puppeteer. This example saves a full-page PNG:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.setViewport({ width: 1080, height: 1024 });
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
})();
The viewport dimensions above match a Puppeteer documentation example; they are not a universal recommendation. networkidle2 is also an example navigation condition, not a guarantee that every site’s content is ready. For dynamic pages, choose a readiness condition that matches the content you need to capture.
#1 Best Overall
Capture one element
Use a locator to find the element, then call its screenshot method. Puppeteer scrolls an element into view if needed; capture fails if the element has been detached from the DOM before the screenshot.
const element = await page.$('#pricing-table');
if (!element) {
throw new Error('Could not find #pricing-table');
}
await element.screenshot({ path: 'pricing-table.png' });
Know what the screenshot call returns
Page.screenshot() returns a Uint8Array by default; requesting base64 encoding returns a string. The API also notes that some operations on a BrowserContext wait for screenshot capture to finish, while bringToFront() does not. Avoid assuming capture is instantaneous when sequencing browser operations.
Take a screenshot with Selenium
Selenium WebDriver supports screenshots, and its documentation includes page- and element-capture examples in multiple language bindings. The exact method signature and options depend on the binding. This Python example uses Selenium’s Firefox driver and saves the current screenshot:
from selenium import webdriver
options = webdriver.FirefoxOptions()
options.add_argument('-headless')
driver = webdriver.Firefox(options=options)
try:
driver.set_window_size(1080, 1024)
driver.get('https://example.com')
driver.save_screenshot('page.png')
finally:
driver.quit()
Install Selenium and the browser driver required by your environment before running the example. Selenium’s documentation describes WebDriver as controlling browsers locally or remotely; provisioning, browser versions, and driver setup depend on your chosen setup.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Capture an element
In Python, locate the element and call its screenshot method. The method writes the image to the specified file and returns whether saving succeeded.
from selenium.webdriver.common.by import By
element = driver.find_element(By.CSS_SELECTOR, '#pricing-table')
if not element.screenshot('pricing-table.png'):
raise RuntimeError('Element screenshot was not saved')
Check whether the result is full-page
Do not assume a WebDriver screenshot always means the entire document. Selenium’s JavaScript API describes its screenshot operation as best effort, preferring the entire page, then the current window, visible frame, and finally the display containing the browser. That is an API-specific description, not a cross-driver guarantee. Selenium’s Firefox Python API documents full-document screenshot methods, but this Firefox-specific evidence should not be generalized to every browser or binding. Check the API for your exact stack and inspect the output dimensions.
Make screenshot comparisons reproducible
A screenshot comparison is meaningful only when the page is rendered under controlled conditions. Set the viewport explicitly and record the browser, version, and capture settings used. Puppeteer’s getting-started example sets a 1080 × 1024 viewport; Selenium documents window resizing and notes that screen resolution affects rendering.
- Use the same browser and browser version for comparisons unless cross-browser rendering is the question being tested.
- Set the viewport dimensions and device scale behavior explicitly where available.
- Use the same page data, authentication state, and readiness condition.
- Decide whether the requirement is the visible viewport, an element, or the full document.
- Check fonts, lazy-loaded images, and other content that can change after navigation.
- Confirm the output encoding and storage path match the consuming system.
Puppeteer’s screen-configuration documentation describes an 800 × 600 headless screen unless --window-size is specified. It also describes --screen-info configuration as headless-only. Treat those as documented configuration details, not assumptions about headful physical displays or recommended capture sizes.
Rank #3
Proof-of-concept checklist
Before committing to either framework, run a small capture test against the exact site and environment you intend to automate:
- Identify the browser, browser version, language binding, and protocol you will use.
- Set the target viewport and verify the rendered dimensions.
- Capture both the viewport and a long page; compare the resulting scope and clipping.
- Capture a representative element, including one that may be below the fold or updated dynamically.
- Test the page-readiness condition against the site’s actual loading behavior.
- Verify image encoding, artifact naming, storage, and error handling.
- Check how browsers will be provisioned and whether the required parallel runs are practical in your environment.
This checklist is an implementation aid, not a claim that either framework has been benchmarked against the other.
Troubleshoot common screenshot failures
The screenshot is only the visible window
Cause: The chosen driver or API captured the current window rather than the full document, or does not support the assumed full-page option. Fix: Verify the exact binding and browser documentation, use a supported full-document method where available, and inspect the output dimensions in your proof of concept.
Free tools Windows power users keep installed
One-click scans. No signup required.
An element screenshot fails because the element is missing
Cause: The selector did not match, the page had not rendered the element, or the element was detached before Puppeteer captured it. Fix: Confirm the selector, wait for the target element to appear, and reacquire it after page updates before calling the screenshot method.
Rank #4
The image is cropped or differs between runs
Cause: Viewport or screen dimensions vary, or the page has not reached a consistent state. Fix: Set dimensions explicitly, use a site-appropriate readiness condition, and keep browser version and page data fixed when comparing output.
The capture runs before important content appears
Cause: Navigation completion does not necessarily mean application content, fonts, or lazy-loaded assets are ready. Fix: Wait for a relevant selector or other condition tied to the content you need. Treat generic network-idle settings as a starting point rather than a universal readiness test.
The script hangs or leaves browser processes behind
Cause: The browser is not closed after an error, or the navigation/readiness condition does not complete as expected. Fix: Put browser cleanup in a finally block, as in the examples, and set timeouts appropriate to your environment.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
If you need an image or PDF without provisioning and maintaining a browser session, ScreenshotNeo is a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF. Example using cURL:
Best Value
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners are accepted before capture and removed along with known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Can Selenium take screenshots?
Yes. Selenium WebDriver documents page and element screenshot methods; exact behavior and signatures depend on the browser and language binding.
Which is better for screenshots, Puppeteer or Selenium?
Neither is a universal winner. Choose based on your codebase and browser-control requirements, then test the exact screenshot scope and environment you need.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




