Skip to main content
app.device.screenshot() returns a PNG as a Buffer: the screen, one element, or the whole content of a scroll view, scrolled and stitched. With a name it is also saved with the test’s artifacts and attached to the report.

Taking a screenshot

screenshot(target?, options?)

Types: ScreenshotTarget · ScreenshotOptions Without a target, the screen as shown; on the web, the browser viewport.

An element

screenshot(target) cuts one element out of the screen: the part of it that is on the screen. { full: true } takes all of it — a scroll view with its whole content, an element partly scrolled away together with the rest — scrolled and stitched.

A whole page

screenshot({ fullPage: true }) takes the whole content of the screen’s main scroll view, the largest one. { fullPage: target } takes the whole content of the scroll view matching target.
A full-page screenshot is the same on every platform:
  1. Quiesco scrolls the scroll view to the top, programmatically (as scrollToEdge does in js mode).
  2. It takes a screenshot per screenful and stitches them: everything above the scroll view (status bar, header) from the first one, the newly revealed strip of each next one, and what is below the scroll view (tab bar) from the last one. So fixed headers and footers appear once.
  3. A virtualized list that renders more rows as it scrolls is followed to its end.
  4. Scroll indicators are hidden meanwhile (native), and the scroll position is put back afterwards.
Content that changes while it scrolls (sticky section headers, animations) shows as it was when each screenful was taken.

A WebView element

An element of a page inside a WebView has its own screenshot(): it is scrolled into view first, and the part inside the WebView’s visible area is taken. See WebView.
On the web, a screenshot fails with DIALOG_OPEN while a browser dialog (alert, confirm) is open: the page does not paint until it is answered. See system UI.
Status bar overrides for clean screenshots — the clock at 9:41, a full battery — are on app and device.