Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use Playwright’s page-level screenshot method with fullPage: true to capture the full scrollable page rather than only the visible viewport. For example: await page.screenshot({ path: 'full-page.png', fullPage: true });

Capture the full page with page.screenshot()

After navigating to the page and waiting for the content you need, call page.screenshot() with fullPage: true. Playwright’s Page API documents this option as capturing the full scrollable page instead of the currently visible viewport; it defaults to false.

await page.goto('https://example.com');
await page.screenshot({ path: 'full-page.png', fullPage: true });

Replace the URL with your target. The example assumes page is an existing Playwright Page object. Choose an appropriate readiness condition for your application before capturing; the required wait depends on the page and the content you want in the image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the output format and capture behavior

Save an image

The path option saves the screenshot. Playwright can infer the format from the filename extension, or you can set type explicitly. The documented image types are PNG, JPEG, and WebP. See the screenshot options for current details.

await page.screenshot({
  path: 'full-page.webp',
  fullPage: true,
  type: 'webp',
});

Make captures more repeatable

For a capture where animation state should not vary, set animations: 'disabled'. Playwright fast-forwards finite animations and cancels infinite animations to their initial state for the screenshot, then plays them over. The default is allow.

await page.screenshot({
  path: 'full-page.png',
  fullPage: true,
  animations: 'disabled',
});

Control pixel scale

The scale option controls the relationship between CSS pixels and image pixels. 'css' produces one image pixel per CSS pixel; 'device' uses device pixels and can produce a larger high-DPI image. The default is 'device'.

await page.screenshot({
  path: 'full-page.png',
  fullPage: true,
  scale: 'css',
});

Mask changing or sensitive regions

Use mask when selected locator areas should be covered in the screenshot. The documented default mask color is pink, and the color can be configured. Consult the Page screenshot API for the option’s accepted values and usage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the right screenshot scope

page.screenshot({ fullPage: true }) targets the full scrollable page. An element screenshot has a narrower scope: it captures the element, and a scrollable element’s screenshot shows only the content currently scrolled into view. Playwright discourages the older ElementHandle screenshot approach and recommends locator-based locator.screenshot() instead. See the ElementHandle screenshot documentation.

Use full-page screenshots in Playwright Test

For visual assertions with the Playwright test runner, use its screenshot assertion and configure it for a full-page image. Screenshot assertions are specific to Playwright Test; they are not a replacement for calling page.screenshot() in other workflows. Refer to the snapshot assertion API for the assertion options.

Troubleshoot common capture issues

  • The image shows only the viewport: confirm that you called the page-level method and set fullPage: true. The option defaults to false.
  • The image is missing content that appears later: wait for the application state or content your capture requires before taking the screenshot. The right readiness condition is page-specific.
  • The screenshot is larger than expected: check scale. Its default is 'device'; use 'css' for one image pixel per CSS pixel.
  • The image differs between runs: consider animations: 'disabled' to control animation behavior during capture.
  • You need only one component: use a locator screenshot for the element rather than a full-page screenshot. A scrollable element capture is limited to its currently scrolled content.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a one-request screenshot API instead of setting up a Playwright browser, ScreenshotNeo accepts a URL and returns an image or PDF. Its clean-shot options can accept cookie or consent banners and remove supported consent platforms, newsletter popups, and chat widgets before capture. Bot checks, blank pages, and failed loads are not billed, and responses indicate the page verdict and billing status. An MCP server lets AI agents use its screenshot tools.

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 documentation for API details. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.