---
id: api/commands/screenshot
title: cy.screenshot()
description: >-
  Take screenshots in Cypress tests with cy.screenshot(). Capture the full page,
  the viewport, one element, or the Command Log, and save each as a PNG.
section: api
source_path: docs/api/commands/screenshot.mdx
version: 1934fa485ad0afcbbd3bdb674d5c5f1f991b55cf
updated_at: '2026-11-14T05:15:51.878Z'
---
# screenshot

`cy.screenshot()` captures the application under test and saves it as a PNG in your screenshots folder, so you have a record of exactly what the page looked like at that step of the test. It can capture the whole page, the visible viewport, a single element, or the entire Cypress runner, including the [Command Log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log).

Use it to:

*   capture a single element, such as a card or a form
*   keep a baseline image for a visual regression tool to compare against
*   check a responsive layout at several viewport sizes
*   keep changing content, such as timestamps, out of the image
*   keep sensitive data out of screenshots, and out of any service you send them to
*   capture the images for your product documentation and recapture them whenever your UI changes

To see why a test failed, you don't need `cy.screenshot()`. During `cypress run`, Cypress [takes a screenshot automatically when a test fails](#Automatic-screenshots-on-test-failure-in-cypress-run).

## Syntax

```
.screenshot()
.screenshot(fileName)
.screenshot(options)
.screenshot(fileName, options)

// ---or---

cy.screenshot()
cy.screenshot(fileName)
cy.screenshot(options)
cy.screenshot(fileName, options)
```

### Usage

**Correct Usage**

```
cy.screenshot()
cy.get('.post').screenshot()
cy.window().screenshot()
```

**Incorrect Usage**

```
cy.get('li').screenshot() // Errors when 'li' matches more than one element
```

### Arguments

**fileName _(String)_**

A name for the image file, relative to the [screenshots folder](/llm/markdown/app/references/configuration.md#Folders--Files) and the path to the spec file. When passed a path, Cypress creates the folder structure. See the [Naming conventions](#Naming-conventions) below for more.

**options _(Object)_**

Pass in an options object to change the default behavior of `.screenshot()`.

| Option | Default | Description |
| --- | --- | --- |
| `blackout` | `[]` | Array of selectors. Cypress blacks out every element that matches each selector. Doesn't apply to `runner` captures. |
| `capture` | `'fullPage'` | Which part of the browser to capture: `viewport`, the visible part of the application under test; `fullPage`, the whole application under test from top to bottom; or `runner`, the entire browser window, including the Command Log. Cypress ignores it for element screenshots and always uses `runner` for automatic failure screenshots. When the Runner UI is hidden, the default when [Test Replay](/llm/markdown/cloud/features/test-replay.md) is enabled during `cypress run` and also with [`--no-runner-ui`](/llm/markdown/app/references/command-line.md#cypress-run-no-runner-ui), a `runner` capture shows only the application under test in the current viewport. It still ignores `blackout` and still scales the app. |
| `clip` | `null` | Position and size, in pixels, to crop the final image to, in the shape `{ x: 0, y: 0, width: 100, height: 100 }`. |
| `disableTimersAndAnimations` | `true` | When `true`, Cypress pauses JavaScript timers (such as `setTimeout` and `setInterval`) and CSS animations while it takes the screenshot. |
| `log` | `true` | Displays the command in the [Command Log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log). |
| `onAfterScreenshot` | `null` | A callback Cypress calls right after it takes the screenshot. Its first argument is a jQuery-wrapped element: the captured element for an element screenshot, or the document's root `<html>` element otherwise. Its second argument holds the screenshot's properties, such as the `path` it was saved to and its `dimensions`. |
| `onBeforeScreenshot` | `null` | A callback Cypress calls right before it takes the screenshot. Its argument is a jQuery-wrapped element: the captured element for an element screenshot, or the document's root `<html>` element otherwise. |
| `overwrite` | `false` | Whether to replace an existing screenshot with the same file name instead of saving a numbered copy. |
| `padding` | `null` | Padding to add around an element screenshot: a number, or an array of up to four numbers in [CSS shorthand notation](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties). Cypress ignores it for other screenshots. |
| `scale` | `false` | Whether to scale the application under test to fit the browser viewport. Always `true` for `runner` captures. |
| `timeout` | [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.screenshot()` to resolve before [timing out](#Timeouts). |

For more details on these options and to set some as defaults across all uses of `.screenshot()`, see the [Cypress.Screenshot API doc](/llm/markdown/api/cypress-api/screenshot-api.md).

### Yields

*   `.screenshot()` yields the same subject it was given.
*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the subject after `.screenshot()`.

## Examples

Cypress saves screenshots in the `cypress/screenshots` folder by default. To save them somewhere else, set `screenshotsFolder` in the [Cypress configuration](/llm/markdown/app/references/configuration.md#Folders--Files).

### No Args

#### Take a screenshot

cypress/e2e/users.cy.js

```
describe('users', () => {
  it('shows the list', () => {
    // saves the screenshot as
    // cypress/screenshots/users.cy.js/users -- shows the list.png
    cy.screenshot()
  })
})
```

### Filename

#### Take a screenshot and save as a specific filename

cypress/e2e/nav.cy.js

```
// saves the screenshot as
// cypress/screenshots/nav.cy.js/clicking-on-nav.png
cy.screenshot('clicking-on-nav')
```

#### Take a screenshot and save in a specific directory

cypress/e2e/login.cy.js

```
// saves the screenshot as
// cypress/screenshots/login.cy.js/actions/login/clicking-login.png
cy.screenshot('actions/login/clicking-login')
```

#### Overwrite a baseline screenshot instead of numbering a new copy

By default, Cypress saves a second screenshot with the same name as `checkout-baseline (1).png`. With `overwrite: true`, it replaces `checkout-baseline.png`, so the file always holds the latest capture.

```
cy.screenshot('checkout-baseline', { overwrite: true })
```

### Capture

#### Capture the viewport, the full page, or the whole Cypress runner

The `capture` option decides how much of the browser ends up in the image.

```
cy.screenshot('viewport', { capture: 'viewport' })
cy.screenshot('full-page', { capture: 'fullPage' })
cy.screenshot('runner', { capture: 'runner' })
```

`viewport` captures the part of the application under test that's currently visible, here 800 x 500 pixels:

`fullPage`, the default, scrolls through the application under test and captures it from top to bottom:

`runner` captures the entire browser window, including the Command Log, with the three `screenshot` commands from the example:

### Clip

#### Crop a screenshot to a specific position and size

```
// clips the screenshot to 400px x 300px,
// starting 20px from the top and left
cy.screenshot({ clip: { x: 20, y: 20, width: 400, height: 300 } })
```

### Blackout

#### Black out dynamic or sensitive content in screenshots

Content that changes between runs, such as relative timestamps or user avatars, makes screenshots of the same page differ from run to run. `blackout` covers every element that matches a selector with a black box, keeping the layout intact:

```
cy.screenshot('dashboard', { blackout: ['.timestamp', '[data-cy=avatar]'] })
```

`blackout` applies to `viewport` and `fullPage` captures only. A `runner` capture ignores it.

#### Keep sensitive data out of screenshots, including failures

`blackout` also keeps sensitive information, such as names, email addresses, or account numbers, out of the screenshots Cypress saves, and so out of any service you send them to, such as CI build artifacts, a visual testing service, or Cypress Cloud. To apply it to every screenshot, set it with `Cypress.Screenshot.defaults()`, as shown in [Blackout elements in screenshots](/llm/markdown/cloud/account-management/data-storage-and-masking.md#Blackout-elements-in-screenshots).

`blackout` doesn't apply to `runner` captures, and the screenshots Cypress takes when a test fails are always `runner` captures. Sensitive information on the page stays visible in failure screenshots, even with a `blackout` default.

To cover failure screenshots too, hide sensitive elements in the default `onBeforeScreenshot` and `onAfterScreenshot` callbacks. These run for every screenshot, failure screenshots included:

cypress/support/e2e.js

```
Cypress.Screenshot.defaults({
  onBeforeScreenshot($el) {
    $el.find('[data-sensitive]').css('visibility', 'hidden')
  },
  onAfterScreenshot($el) {
    $el.find('[data-sensitive]').css('visibility', '')
  },
})
```

The Command Log in a failure screenshot can also show values your test typed. To mask those, and to control what Test Replay and videos capture, see [Data storage and controls](/llm/markdown/cloud/account-management/data-storage-and-masking.md).

### Screenshot an element

#### Take a screenshot of the first `.post` element

```
cy.get('.post').first().screenshot()
```

#### Add 10px of padding around an element screenshot

```
cy.get('.post').first().screenshot({ padding: 10 })
```

#### Add different padding to each side of an element screenshot

`padding` accepts [CSS shorthand](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties) as an array of one to four numbers:

```
// 10px above and below, 20px left and right
cy.get('.post')
  .first()
  .screenshot({ padding: [10, 20] })
```

Without padding, the image ends at the element's border:

With `padding: [10, 20]`, the image includes 10px of the page above and below the element and 20px on each side:

#### Screenshot an element inside `.within()`

Inside [`.within()`](/llm/markdown/api/commands/within.md), `cy.screenshot()` captures the `.within()` subject, even when chained off `cy`. Pass `capture: 'runner'` to capture the whole runner instead.

```
cy.get('.post')
  .first()
  .within(() => {
    cy.screenshot('first-post') // captures only the first .post
    cy.screenshot('first-post-runner', { capture: 'runner' }) // ignores .within()
  })
```

#### Chain off the screenshot to click the element captured

`.screenshot()` yields the element it captured, so you can chain another command off it. `.screenshot()` doesn't query the element again, so chain off it only while the element stays in the DOM. If the page might replace the element, query it again with [`cy.get()`](/llm/markdown/api/commands/get.md) instead.

```
cy.get('button').first().screenshot().click()
```

### Change the page only for the screenshot with `onBeforeScreenshot`

`onBeforeScreenshot` runs right before the capture and `onAfterScreenshot` right after it, so a change made in the first and undone in the second never affects the rest of the test. Here a cookie banner is hidden for the screenshot and shown again afterward:

```
cy.screenshot('home', {
  onBeforeScreenshot($el) {
    $el.find('.cookie-banner').hide()
  },
  onAfterScreenshot($el) {
    $el.find('.cookie-banner').show()
  },
})
```

Unlike [`blackout`](#Blackout), which covers an element and keeps its space, hiding an element removes it from the image entirely.

### Override the screenshot defaults for a single screenshot

Defaults set with [`Cypress.Screenshot.defaults()`](/llm/markdown/api/cypress-api/screenshot-api.md), usually in a support file, apply to every `cy.screenshot()`:

cypress/support/e2e.js

```
Cypress.Screenshot.defaults({
  blackout: ['.timestamp', '[data-cy=avatar]'],
})
```

An option passed to `cy.screenshot()` replaces the default for that screenshot rather than merging with it:

```
// uses the default blackout list
cy.screenshot('dashboard')
// replaces the default list: every h2 is blacked out, timestamps and avatars aren't
cy.screenshot('dashboard-titles', { blackout: ['h2'] })
```

### Take a screenshot at several viewport sizes

To check a responsive layout, loop over the widths your layout changes at, set each with [`cy.viewport()`](/llm/markdown/api/commands/viewport.md), and name each screenshot after its width. This saves `home-375px.png`, `home-768px.png`, and `home-1280px.png`:

```
const widths = [375, 768, 1280]

widths.forEach((width) => {
  cy.viewport(width, 720)
  cy.screenshot(`home-${width}px`)
})
```

A height of 720 keeps each viewport within the headless browser's screen, so no screenshot is cut off. See [Screenshots larger than the headless browser screen](#Screenshots-larger-than-the-headless-browser-screen).

### Capture screenshots for documentation and keep them current

Product docs, help centers, and READMEs show screenshots of your UI, and those images go out of date every time the UI changes. A spec that visits each documented page and takes a named screenshot recaptures every image on each run, so the images always match your app.

cypress/e2e/docs-screenshots.cy.js

```
describe('documentation screenshots', () => {
  beforeEach(() => {
    // a fixed size and date keep each image the same from run to run
    cy.viewport(1280, 720)
    cy.clock(new Date('2026-01-15T09:00:00Z'), ['Date'])
  })

  it('dashboard', () => {
    cy.visit('/dashboard')
    cy.get('[data-cy=dashboard]').should('be.visible')
    cy.screenshot('docs/dashboard', { capture: 'viewport' })
  })
})
```

`cypress run` empties the screenshots folder before each run, so move the documentation images out of it as soon as Cypress saves them. This [`after:screenshot`](/llm/markdown/api/node-events/after-screenshot-api.md) handler moves every screenshot named `docs/...` into a `docs/images` folder, replacing the previous version of each image:

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')
const fs = require('fs')
const path = require('path')

module.exports = defineConfig({
  // setupNodeEvents can be defined in either
  // the e2e or component configuration
  e2e: {
    setupNodeEvents(on, config) {
      on('after:screenshot', (details) => {
        // move only the screenshots named docs/...
        if (!details.name?.startsWith('docs/')) return

        const newPath = path.join(
          config.projectRoot,
          'docs',
          'images',
          path.basename(details.path)
        )

        fs.mkdirSync(path.dirname(newPath), { recursive: true })
        fs.renameSync(details.path, newPath)

        // return the new path so the test results point to the moved file
        return { path: newPath }
      })
    },
  },
})
```

```
import { defineConfig } from 'cypress'
import fs from 'fs'
import path from 'path'

export default defineConfig({
  // setupNodeEvents can be defined in either
  // the e2e or component configuration
  e2e: {
    setupNodeEvents(on, config) {
      on('after:screenshot', (details) => {
        // move only the screenshots named docs/...
        if (!details.name?.startsWith('docs/')) return

        const newPath = path.join(
          config.projectRoot,
          'docs',
          'images',
          path.basename(details.path)
        )

        fs.mkdirSync(path.dirname(newPath), { recursive: true })
        fs.renameSync(details.path, newPath)

        // return the new path so the test results point to the moved file
        return { path: newPath }
      })
    },
  },
})
```

Run the spec whenever your UI changes, such as on a schedule in CI, and commit the updated images with your docs.

### Get screenshot info from the `onAfterScreenshot` callback

cypress/e2e/profile.cy.js

```
cy.screenshot('my-screenshot', {
  onAfterScreenshot($el, props) {
    // $el is the jQuery-wrapped <html> element, since no element was chained
    // props has information about the screenshot,
    // including but not limited to the following:
    // {
    //   blackout: [],
    //   dimensions: {
    //     height: 660,
    //     width: 1000,
    //   },
    //   duration: 2300, // in milliseconds
    //   multipart: false,
    //   name: 'my-screenshot',
    //   path: '/Users/janelane/project/cypress/screenshots/profile.cy.js/my-screenshot.png',
    //   pixelRatio: 1,
    //   scaled: false,
    //   size: 15360, // in bytes
    //   takenAt: '2026-11-01T17:00:00.000Z',
    //   testAttemptIndex: 0,
    // }
  },
})
```

## Notes

### Naming conventions

Cypress saves each screenshot in the [screenshots folder](/llm/markdown/app/core-concepts/writing-and-organizing-tests.md#How-asset-file-paths-are-generated), inside a folder for its spec file: `{screenshotsFolder}/{adjustedSpecPath}/{fileName}`. The folder's path follows the spec file's path, minus any parent folders that all spec files share. Cypress names each file by these rules:

| Screenshot | File name |
| --- | --- |
| Default, with no name passed | `{testName}.png`, from the suite and test titles, such as `users -- shows the list.png` |
| Duplicate of an earlier screenshot | `(1)`, `(2)`, and so on appended, such as `{testName} (1).png` or `{name} (1).png` |
| Failure screenshot | `{testName} (failed).png` |
| Named | `{name}.png`, with a `/` in the name creating folders |
| Taken during a [test retry](/llm/markdown/app/guides/test-retries.md#Screenshots) | `(attempt {n})` appended, such as `{testName} (attempt 2).png` or `{testName} (failed) (attempt 2).png` |

Cypress numbers duplicates, named or not, across several `cypress run` processes that share a project folder too, so one run never overwrites another run's screenshot. To replace a duplicate instead, pass `{ overwrite: true }` to `cy.screenshot()`. Cypress also removes characters that aren't valid in a filename, and truncates a name too long for the file system.

For example, when every spec file is under `cypress/e2e/users/`, Cypress drops `users/` from the folder name, so this spec saves its screenshots in `cypress/screenshots/login.cy.js/`:

cypress/e2e/users/login.cy.js

```
describe('my tests', () => {
  it('takes a screenshot', () => {
    cy.screenshot()
    cy.screenshot()
    cy.screenshot()
    cy.screenshot('my-screenshot')
    cy.screenshot('my-screenshot')
    cy.screenshot('my/nested/screenshot')
  })
})
```

After the test passes, the screenshots folder holds:

```
cypress/screenshots/
└── login.cy.js/
    ├── my/
    │   └── nested/
    │       └── screenshot.png
    ├── my tests -- takes a screenshot.png
    ├── my tests -- takes a screenshot (1).png
    ├── my tests -- takes a screenshot (2).png
    ├── my-screenshot.png
    └── my-screenshot (1).png
```

A test that fails and then passes on a [retry](/llm/markdown/app/guides/test-retries.md) adds both suffixes. This test fails its first attempt and passes its second:

cypress/e2e/users/login.cy.js

```
describe('my flaky tests', () => {
  it('passes on retry', { retries: { runMode: 1 } }, () => {
    cy.screenshot()
    cy.then(() => {
      // fail the first attempt only
      if (Cypress.currentRetry === 0) throw new Error('flaky')
    })
  })
})
```

In `cypress run`, it saves three screenshots:

```
cypress/screenshots/
└── login.cy.js/
    ├── my flaky tests -- passes on retry.png              ← attempt 1, cy.screenshot()
    ├── my flaky tests -- passes on retry (failed).png     ← attempt 1, automatic failure screenshot
    └── my flaky tests -- passes on retry (attempt 2).png  ← attempt 2, cy.screenshot()
```

For how Cypress organizes tests and the files a run generates, see [Writing and Organizing Tests](/llm/markdown/app/core-concepts/writing-and-organizing-tests.md#Generated-assets).

### Process saved screenshots with `after:screenshot`

The [`after:screenshot` event](/llm/markdown/api/node-events/after-screenshot-api.md) runs after Cypress writes each screenshot to disk and receives its details, so you can rename, move, or edit the file.

### Compare screenshots with visual regression plugins

`cy.screenshot()` saves an image but doesn't compare it with anything. To catch visual changes, use a visual regression plugin or service. Plugins typically add their own command that captures the page and compares it, pixel by pixel, with a baseline image. See [open source plugins](/llm/markdown/app/tooling/visual-testing.md#Open-source-plugins) and [commercial services](/llm/markdown/app/tooling/visual-testing.md#Commercial-services) on the Visual Testing page.

The [`blackout`](#Blackout) and `disableTimersAndAnimations` options on this page help keep those comparisons stable, by covering content that changes between runs and by pausing animations during the capture.

### Automatic screenshots on test failure in `cypress run`

During `cypress run`, including in [Continuous Integration](/llm/markdown/app/continuous-integration/overview.md), Cypress takes a screenshot automatically when a test fails. To turn this off, set [`screenshotOnRunFailure`](/llm/markdown/app/references/configuration.md#Screenshots) to `false` in your Cypress configuration or with [`Cypress.Screenshot.defaults()`](/llm/markdown/api/cypress-api/screenshot-api.md).

A failure screenshot uses `capture: 'runner'`, so it shows the Command Log next to the application under test, unless the Runner UI is hidden (see below). Here, [`cy.get()`](/llm/markdown/api/commands/get.md) timed out looking for an element that never appeared, and its row is highlighted in red:

```
cy.get('[data-cy=new-post]').click()
```

The error message itself isn't in this screenshot. The Command Log can still be rendering it when Cypress takes the screenshot.

When the Runner UI is hidden, a failure screenshot has no Command Log. It shows only the application under test in the current viewport. The Runner UI is hidden by default when you record a run with [Test Replay](/llm/markdown/cloud/features/test-replay.md) enabled, and whenever you pass [`--no-runner-ui`](/llm/markdown/app/references/command-line.md#cypress-run-no-runner-ui) to `cypress run`. To see the commands that led to the failure, open the test in Test Replay, or pass [`--runner-ui`](/llm/markdown/app/references/command-line.md#cypress-run-runner-ui) to keep the Command Log in the screenshot.

### Find screenshots locally, in CI, and in Cypress Cloud

#### Find screenshots on your machine

Cypress saves every screenshot in the screenshots folder, `cypress/screenshots` by default, following the [naming conventions](#Naming-conventions) above. This applies to both `cypress open` and `cypress run`, though Cypress takes [failure screenshots](#Automatic-screenshots-on-test-failure-in-cypress-run) only in `cypress run`.

Before each `cypress run`, Cypress deletes everything in the screenshots folder, so the folder holds only the latest run's screenshots. To keep screenshots between runs, move them elsewhere, as in the [documentation example](#Capture-screenshots-for-documentation-and-keep-them-current), or set [`trashAssetsBeforeRuns`](/llm/markdown/app/references/configuration.md#Screenshots) to `false`.

#### Save screenshots as CI build artifacts

On a CI machine, the screenshots folder disappears when the job ends. To keep the screenshots, save the folder as a build artifact. For example, in GitHub Actions:

```
- name: Save screenshots
  uses: actions/upload-artifact@v6
  if: failure()
  with:
    name: cypress-screenshots
    path: cypress/screenshots
    if-no-files-found: ignore
```

`if: failure()` saves the folder only when an earlier step fails, which is when failure screenshots exist. Remove it to keep screenshots from passing runs too. For other providers, see their documentation on build artifacts.

#### View screenshots in Cypress Cloud

When you [record a run](/llm/markdown/app/continuous-integration/overview.md#Record-tests) to [Cypress Cloud](/llm/markdown/cloud/get-started/introduction.md), Cypress uploads its screenshots with the results. Open a test in the run to see them in the [Artifacts](/llm/markdown/cloud/features/recorded-runs.md#Artifacts) section of the test detail sidebar, which shows failure screenshots and screenshots from `cy.screenshot()`.

#### Get screenshots from Cypress Cloud with Cloud MCP or the Cloud CLI

*   [Cloud MCP](/llm/markdown/cloud/integrations/cloud-mcp.md#Available-tools): the `cypress_get_test_screenshots` tool returns a test's screenshots, including failure screenshots and screenshots from `cy.screenshot()`, from the last attempt by default. For example, ask your AI assistant to "show me the screenshot from the failed checkout test."
*   [Cloud CLI](/llm/markdown/cloud/integrations/cloud-cli.md#cy-cloud-test-get): `cy-cloud test get --testId <testId> --screenshot ./screenshots` saves a test's failure screenshot to disk.

### Screenshots larger than the headless browser screen

In a headless `cypress run`, the browser's screen is 1280x720 by default. Cypress cuts every screenshot off at the screen's edges, so a viewport wider or taller than the screen saves a smaller image, for both `viewport` and `fullPage` captures:

| Viewport | Saved image |
| --- | --- |
| 768x1024 | 768x720 |
| 1440x900 | 1280x720 |

To capture larger screenshots, [set a larger screen size](/llm/markdown/api/node-events/browser-launch-api.md#Set-screen-size-when-running-headless).

### Fixed and sticky headers in element screenshots

To capture an element, Cypress scrolls it to the top of the viewport. A `position: fixed` or `position: sticky` header at the top of the page then sits on top of the element and covers part of the image:

Hide the header for the screenshot and restore it afterward. Setting `visibility` to `hidden` keeps the header's space in the layout, so nothing else on the page moves:

```
cy.get('.sticky-header').invoke('css', 'visibility', 'hidden')
cy.get('.post').eq(3).screenshot()
cy.get('.sticky-header').invoke('css', 'visibility', '')
```

## Rules

### Requirements

*   `cy.screenshot()` can be chained off of `cy` or off a command that yields a single DOM element, the `window`, or the `document`.
*   `cy.screenshot()` throws an error if the subject contains more than one element.
*   Inside [`.within()`](/llm/markdown/api/commands/within.md), `cy.screenshot()` captures the `.within()` subject element, unless `capture` is `'runner'`.

### Assertions

*   `cy.screenshot()` will only run assertions you have chained once, and will not [retry](/llm/markdown/app/core-concepts/retry-ability.md).

### Timeouts

*   `cy.screenshot()` can time out waiting for the browser to capture and save the screenshot, for the duration of its `timeout` option, which defaults to [`responseTimeout`](/llm/markdown/app/references/configuration.md#Timeouts).

## Command Log

**_Take a screenshot with a specific filename_**

```
cy.screenshot('my-image')
```

The commands above will display in the Command Log as:

When clicking on `screenshot` within the command log, the console outputs the following:

## History

| Version | Changes |
| --- | --- |
| [16.2.1](/llm/markdown/app/references/changelog.md#16-2-1) | Duplicate file names are numbered across `cypress run` processes that share a project folder. |
| [3.5.0](/llm/markdown/app/references/changelog.md#3-5-0) | Added support for option `padding`. |

## See also

*   [`Cypress.Screenshot`](/llm/markdown/api/cypress-api/screenshot-api.md)
*   [`after:screenshot`](/llm/markdown/api/node-events/after-screenshot-api.md)
*   [Screenshots and Videos](/llm/markdown/app/guides/screenshots-and-videos.md)
*   [Visual Testing](/llm/markdown/app/tooling/visual-testing.md)
