Selenium Full-Page Screenshots vs. Playwright: Which Is Easier?
Playwright has a direct full-page screenshot option. See how it compares with Selenium’s driver-specific APIs, with runnable examples and practical trade-offs.
Short answer: Playwright is usually easier to use for a full-page screenshot because its Page API has a direct fullPage: true option. Selenium supports full-page screenshots in documented Firefox APIs, but support depends on the browser driver and language binding. This is a judgment based on API documentation and discoverability, not a usability test or benchmark. If your project already uses Selenium with a driver that supports full-page capture, staying with that stack may be easier overall.
This guide compares the APIs, gives runnable Python examples for both tools, and covers output, repeatability, troubleshooting, and when a screenshot API can remove browser setup altogether.
1. The practical difference
| Question | Playwright | Selenium |
|---|---|---|
| How do I request a full-page image? | page.screenshot({ fullPage: true }) |
Use a driver and binding API that explicitly supports full-page capture; documented Python and Java examples are Firefox-specific. |
| Is full-page behavior apparent from the call? | Yes. The Page screenshot API documents the option directly; its default is false. | Not uniformly from the general screenshot API. Selenium describes general screenshots as best-effort and potentially limited to the page, window, visible frame, or display. |
| What should I verify? | Whether the page is ready and stable before capture, plus your desired image format and options. | Whether the exact browser, driver, and language binding you use implement a full-page method. |
| Which is easier? | Usually the simpler choice for a new full-page-only script. | Convenient when Selenium is already your stack and its specific driver supports the required capture. |
Playwright also documents screenshot controls such as output path, scale, animation handling, and masks in the same API. Selenium’s general screenshot documentation should not be read as a guarantee that every driver captures the entire scrollable page. See the official Playwright Page API, Selenium Python Firefox WebDriver API, Selenium Java full-page interface, and Selenium screenshot documentation.
2. Playwright full-page screenshot in Python
Install Playwright and its browser, then save a full-page PNG. This example uses Chromium, opens a page, waits for the document load event, captures, and closes the browser.
python -m pip install playwright
python -m playwright install chromium
import asyncio
from pathlib import Path
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto("https://example.com", wait_until="load")
await page.screenshot(path="full-page.png", full_page=True)
await browser.close()
asyncio.run(main())
full_page=True captures the full scrollable page rather than just the visible viewport. The screenshot call returns image bytes as well as writing to the requested path. For a repeatable capture, explicitly wait for the page condition you need instead of assuming that navigation completion means every image or client-rendered section is ready.
Useful Playwright screenshot options
path: write the screenshot to a file. The extension determines the image type when supported.full_page: capture the complete scrollable page; defaults to false.type: choose PNG or JPEG where appropriate. JPEG supportsquality; PNG is lossless.quality: set JPEG quality from 0 to 100. It does not apply to PNG.scale: use"css"for CSS-pixel output or"device"for device-scale output.animations: control finite and infinite animations for steadier captures. Choose deliberately: suppressing animations can alter what appears in the image.maskandmask_color: cover selected locators, useful when dynamic content makes visual comparison unstable.omit_background: make the default background transparent in supported output conditions.
Consult the API for the complete current option list and binding-specific syntax. A full-page image can be very tall; page size, memory use, and image encoding time grow with the rendered content.
3. Selenium full-page screenshot in Python with Firefox
Selenium’s Python Firefox WebDriver API documents save_full_page_screenshot(filename) and get_full_page_screenshot_as_png(). Use the Firefox driver API explicitly; do not assume the same method exists on another driver or binding.
python -m pip install selenium
With Firefox and geckodriver available to Selenium, this script saves the screenshot and quits the driver even if navigation or capture fails:
from selenium import webdriver
options = webdriver.FirefoxOptions()
# Uncomment to run without opening a visible browser window:
# options.add_argument("-headless")
driver = webdriver.Firefox(options=options)
try:
driver.get("https://example.com")
driver.save_full_page_screenshot("selenium-full-page.png")
finally:
driver.quit()
To get PNG bytes for another destination instead of saving through the driver:
from selenium import webdriver
options = webdriver.FirefoxOptions()
driver = webdriver.Firefox(options=options)
try:
driver.get("https://example.com")
png_bytes = driver.get_full_page_screenshot_as_png()
with open("selenium-full-page.png", "wb") as image_file:
image_file.write(png_bytes)
finally:
driver.quit()
The Selenium Java HasFullPageScreenshot interface also documents getFullPageScreenshotAs(...), identifies FirefoxDriver as an implementing class, and is marked beta. Confirm the API in the version and binding used by your application before building a workflow around it.
4. Choosing between them
- Start with your existing stack. A project already using Selenium may avoid extra setup by keeping its browser session and using a supported full-page method. For a new script whose central requirement is a full-page screenshot, Playwright’s explicit option is easier to discover and explain.
- Check the exact browser and binding. Selenium’s reviewed full-page examples are Firefox-specific. Verify method availability and behavior in the official documentation for your actual driver and language.
- Decide what “ready” means. A browser can finish navigation before delayed images, client-rendered content, or fonts have settled. Wait for a meaningful selector or page condition, or use a suitable delay where the page has no reliable readiness signal.
- Choose output deliberately. Use PNG for lossless captures and visual testing; use JPEG when smaller photographic images matter more than lossless detail. Choose device or CSS scale consistently if comparing snapshots.
- Stabilize dynamic content. Disable or wait for animations, mask changing regions, and keep viewport, locale, timezone, data, and page state consistent between runs.
A screenshot records rendered visual state. It does not replace inspecting the DOM, accessibility tree, or page semantics. Playwright’s tooling guidance distinguishes visual verification with screenshots from structural inspection with snapshots; see the Playwright screenshot guidance.
5. Reliability, performance, and cost
- Reliability: Close browser sessions in a
finallyblock, set navigation and operation timeouts appropriate to your environment, and handle navigation failures explicitly. Do not treat a screenshot file’s existence as proof that the page rendered correctly. - Readiness: Network-idle conditions can be unsuitable for pages that maintain long-lived connections or continuously fetch data. Prefer an application-specific selector or state check where possible.
- Page size: Full-page output can be much taller than viewport output. Large images use more memory and take longer to encode or transfer. If the task only needs a region, capture that region where your framework supports it.
- Repeatability: Pin browser and automation versions in CI, use fixed viewport settings, and control dynamic data. Driver/browser mismatches are a common source of failures.
- Cost: Both approaches use browser automation infrastructure you operate or provision. Account for browser installation, compute, storage, and maintenance in CI. The reviewed sources provide no comparative benchmark, so there is no supported speed or cost winner between the frameworks.
6. Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Selenium says the full-page method does not exist | The method is specific to the Firefox Python driver API or another supported binding. | Check the exact driver and binding documentation. Use the documented Firefox API, or choose a capture path supported by your current stack. |
| The screenshot contains only the viewport | The call used the general screenshot method without full-page behavior, or the driver does not implement it. | In Playwright, pass full_page=True. In Selenium, verify that the actual API is explicitly a full-page screenshot method. |
| Content is missing at the bottom | Lazy-loaded content may not have rendered before capture. | Scroll through the page to trigger lazy loading, wait for target elements, then capture. For very long pages, verify that the site loads all sections under automated scrolling. |
| Images or fonts appear incomplete | The capture occurred before those resources loaded, or the page blocked them. | Wait for the relevant resources or application state; inspect browser console and network errors. Avoid relying on a fixed short sleep for variable pages. |
| Captures differ from run to run | Animation, timestamps, random content, ads, or personalized state changed. | Fix the test data and environment, control animation behavior, and mask truly irrelevant dynamic regions. |
| Browser fails to start in CI | Browser binaries, driver compatibility, or system dependencies are missing. | Install the required browser and dependencies using the framework’s documented setup for that environment, then confirm browser and driver versions. |
| The output is unexpectedly large | Full-page height and device scale increase pixel count. | Use CSS scale when appropriate, select JPEG for photographic output, or capture only the needed element or region. |
7. Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. Send one GET request with a URL to get a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer())));
Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.
8. FAQ
Is Playwright always easier than Selenium?
No. The recommendation here is specifically about the discoverability of full-page screenshot APIs. Existing Selenium projects with a suitable driver may find Selenium more convenient.
Does a full-page screenshot include content that has not loaded yet?
No. It captures the rendered state available at capture time. Trigger lazy loading and wait for the content your screenshot needs.
Does Selenium support full-page screenshots in every browser?
The cited documentation establishes specific Firefox APIs, not universal support. Verify the browser, driver, and language binding you plan to use.
Should I use screenshots to check accessibility?
A screenshot helps review appearance. Use DOM and accessibility inspection for structure and accessibility semantics.
