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?)
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.
- Quiesco scrolls the scroll view to the top, programmatically (as
scrollToEdgedoes injsmode). - 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.
- A virtualized list that renders more rows as it scrolls is followed to its end.
- Scroll indicators are hidden meanwhile (native), and the scroll position is put back afterwards.
A WebView element
An element of a page inside a WebView has its ownscreenshot(): 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.