Runner.screenshots Method

Specifies how TestCafe should take screenshots of the tested pages.

screenshots(options) → this
obsolete: screenshots(path [, takeOnFails] [, pathPattern] ) → this

The options object can include the following properties:

Option Type Description Default
path (optional) String The base path where the screenshots are saved. Note that to construct a complete path to these screenshots, TestCafe uses the default path patterns. You can override these patterns with the pathPattern property. './screenshots'
takeOnFails (optional) Boolean Specifies if screenshots should be taken automatically when a test fails. false
pathPattern (optional) String The pattern to compose screenshot files’ relative path and name. See Path Pattern Placeholders for information about the available placeholders.
fullPage (optional) Boolean Specifies that the full page should be captured, including content that is not visible due to overflow. false

See Screenshots for details.

Pass the disableScreenshots option to the method to disable screenshots:{
    disableScreenshots: true

Related configuration file properties:


    path: 'reports/screenshots/',
    takeOnFails: true,
    pathPattern: '${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png'