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

Use a locator’s waitFor() method to wait for the element to become visible, then call page.screenshot(). For example:

const target = page.locator('.ready');
await target.waitFor({ state: 'visible' });
await page.screenshot({ path: 'page.png' });

Replace .ready with a selector for the page element that signals it is ready to capture. This waits for that element to be visible; it does not prove that every other part of the page has finished loading.

Wait for the state that matches your screenshot

Playwright’s locator wait lets you choose the condition the target must meet before capture. Use visible when the element needs to appear in the image:

const target = page.locator('.ready');
await target.waitFor({ state: 'visible' });
await page.screenshot({ path: 'page.png' });

If the requirement is only that the element exists in the DOM, wait for attached. For a capture that should happen after an element disappears, use hidden or detached, depending on whether it may remain in the DOM but be hidden. A timeout means the requested state was not reached; treat it as a failed readiness condition rather than capturing an image that may be incomplete. See the Locator API documentation for the available wait states.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

DOM presence and visual readiness are different. An attached element may not yet be visible, and a visible target does not guarantee that unrelated content, images, fonts, or animations have settled. Choose the most meaningful readiness condition exposed by the page and add any page-specific checks your capture requires.

Choose what to capture

After the wait, select the screenshot method and output that suit the task:

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
Need Playwright code Result
Current viewport saved to a file await page.screenshot({ path: 'page.png' }); A PNG of the visible viewport.
Full scrollable page await page.screenshot({ path: 'page.png', fullPage: true }); A PNG covering the full page.
Only the target element await target.screenshot({ path: 'element.png' }); An image of the locator’s element.
Image in memory const buffer = await page.screenshot(); Image bytes returned as a buffer.

These are distinct capture scopes: the default page screenshot is the viewport, while fullPage extends capture to the full page and a locator screenshot targets just that element. See the Playwright screenshot guide.

Use locators that survive page changes

Prefer locators based on user-facing attributes or stable test hooks, such as a role, text, label, placeholder, alt text, title, or test ID. CSS and XPath are supported, but selectors tied to a long chain of internal DOM structure can break when the site changes. Playwright recommends locator-based waits and web-first assertions over the discouraged page.waitForSelector() method. Locator actions also provide auto-waiting and retry behavior; add an explicit wait when screenshot timing depends on a particular state. See the Playwright locators guide and Page API guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

Distinguish a saved screenshot from a visual test

For an image artifact, use page.screenshot() or target.screenshot(). For a Playwright Test baseline comparison, use expect(page).toHaveScreenshot() instead. That assertion waits for two consecutive page screenshots to match, then compares the resulting capture with the expected snapshot; it belongs to the Playwright Test runner workflow, not ordinary image saving. See the visual comparisons documentation.

Rendering can differ with the operating system, browser version, settings, hardware, power source, and headless mode. Keep the environment consistent between baseline creation and comparison when visual diffs need to be reliable. The Playwright visual comparison guidance describes these sources of variation.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management

Troubleshoot selector-based captures

  • The wait times out: Check that the selector matches the intended element and that the page reaches the requested state. Do not silently capture on timeout if readiness matters.
  • The element exists but is absent from the image: An attached state only establishes DOM presence. Wait for visible when the target must appear onscreen.
  • The target is visible but the rest of the page is unfinished: A single selector is not a guarantee that unrelated asynchronous content has settled. Add a meaningful page-specific readiness check.
  • The image has the wrong scope: The default page capture is the viewport. Set fullPage: true for the full page or call target.screenshot() for just the element.
  • The selector breaks after a site change: Replace brittle structural CSS or XPath with a user-facing locator or a stable test ID where available.
  • A screenshot assertion behaves differently from a file capture: toHaveScreenshot() is a Playwright Test baseline assertion; use page.screenshot() when you simply need an image.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need an API call rather than a Playwright browser workflow, ScreenshotNeo returns a screenshot or PDF from a URL. For an API key, use this cURL request; the ScreenshotNeo documentation covers its API:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents using Claude, Cursor, or another MCP client. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

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

Sign up for 1,000 free screenshots a month, with no card required.

Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

Frequently Asked Questions

Should I use `attached` or `visible` before taking a screenshot?

Use `visible` when the element needs to appear in the image. Use `attached` only when DOM presence is sufficient; it does not guarantee visibility.

Does waiting for one selector guarantee the entire page is ready?

No. It confirms only the selected element’s requested state. Other asynchronous content may still be loading.

What does Playwright capture by default?

`page.screenshot()` captures the current viewport unless you request a full-page capture or use a locator screenshot for an element.

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

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.