Scroll the element into view, then query it again and call .screenshot(). Cypress warns that commands depending on the yielded subject should not be chained after .scrollIntoView(), so the fresh query is important. To capture the visible page area instead of the element alone, use cy.screenshot({ capture: 'viewport' }) after scrolling.
Capture the element after scrolling
Use a selector that identifies the target, scroll it into view, then make a new query before asserting visibility and taking the element screenshot:
As an Amazon Associate I earn from qualifying purchases.
cy.get('[data-testid="target"]')
.scrollIntoView()
cy.get('[data-testid="target"]')
.should('be.visible')
.screenshot('target-after-scroll')
The second cy.get() is deliberate: Cypress documents that it is unsafe to chain further commands that rely on the subject after .scrollIntoView(). The screenshot command can be chained from a command yielding a single DOM element. Cypress scrollIntoView documentation · Cypress screenshot documentation
Choose what the screenshot should contain
Only the target element
Call .screenshot() on the queried element as in the example above. Cypress captures the selected element; use the screenshot option padding if you need space around it. The capture option does not apply to element screenshots. See Cypress screenshot options.
#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
The current viewport
Scroll the page to the desired region, then capture the visible application area:
cy.get('[data-testid="target"]').scrollIntoView()
cy.get('[data-testid="target"]').should('be.visible')
cy.screenshot('viewport-after-scroll', { capture: 'viewport' })
This captures the current viewport, not just the element. Cypress’s documentation shows the visibility assertion separately after scrolling. ScrollIntoView API · Screenshot API
The full page or Cypress runner
{ capture: 'fullPage' }captures the application from top to bottom by scrolling and stitching images. Fixed or sticky elements may appear more than once.{ capture: 'runner' }includes the browser viewport and Cypress Command Log. Failure screenshots are coerced to runner capture.
These are distinct from an element screenshot and a current-viewport screenshot; choose based on the output you need. Cypress screenshot API
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
Adjust scrolling and visibility checks
.scrollIntoView() accepts duration, easing, offset, and timeout. An offset adjusts the target position after scrolling, which can help when a fixed header covers it. For example:
cy.get('[data-testid="target"]').scrollIntoView({ offset: { top: -80, left: 0 } })
cy.get('[data-testid="target"]')
.should('be.visible')
.screenshot('target-after-scroll')
The scroll command fires once; it is not itself retried. Assertions added after it are retried until they pass or time out. Cypress snapshots do not accurately show scroll positions, so inspect the actual run or its video when debugging where the page landed. Cypress scrollIntoView API
Understand screenshot timing and saved files
Screenshot capture is asynchronous: the application can change between command issuance and image capture, so the screenshot may not exactly represent the state at the instant the command ran. Cypress describes the screenshot action as taking around 100 ms; that is documentation guidance, not a guaranteed duration or independent benchmark. Cypress screenshot API
Rank #3
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Manually captured screenshots are saved by default in cypress/screenshots, with names based on the spec and test; you can provide a screenshot name, and the folder is configurable. Cypress supplies onAfterScreenshot information such as path and dimensions. The after:screenshot Node event runs after the file is written and can inspect or modify screenshot details; it runs in Node, so Cypress cy commands are unavailable there. Screenshot command · after:screenshot event
Troubleshoot common problems
- The screenshot command acts on the wrong or stale subject: do not chain a subject-dependent command after
.scrollIntoView(). Run a freshcy.get(selector)before checking visibility and capturing. - The target is obscured by a fixed header: adjust
offsetin.scrollIntoView(), then re-query and verify visibility. - The assertion times out: remember the scroll itself runs once; the subsequent visibility assertion retries. Check that the selector matches the intended element and inspect the actual run or video because Cypress snapshots do not accurately represent scroll positions.
- A full-page image repeats a header or other fixed content: this can happen because full-page capture scrolls and stitches images. Use an element screenshot or viewport capture if that better matches the intended output.
- The image differs from the moment the command was issued: capture is asynchronous and the application may change before the image is taken.
Or skip the browser setup:
For a screenshot returned by an API rather than saved by a Cypress test, ScreenshotNeo takes a URL in one GET request and can return PNG, JPEG, WebP, or PDF. Its clean-shot flow accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients.
Example cURL request (replace the example URL and API key):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Learn about ScreenshotNeo or sign up free for 1,000 screenshots a month, no card required.
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.
Recommended Free Tools




