---
id: api/commands/debug
title: cy.debug()
description: Set a debugger in Cypress and log what the previous command yields.
section: api
source_path: docs/api/commands/debug.mdx
version: 3163d68b20e695f2c76d40c85c3f3b956dd19a3b
updated_at: '2026-08-21T20:59:04.402Z'
---
# debug

Set a `debugger` and log what the previous command yields.

You need to have your Developer Tools open for `.debug()` to hit the breakpoint.

## Syntax

```
.debug()
.debug(options)

// ---or---

cy.debug()
cy.debug(options)
```

### Usage

**Correct Usage**

```
cy.debug().getCookie('app') // Pause to debug at beginning of commands
cy.get('nav').debug() // Debug the `get` command's yield
```

### Arguments

**options _(Object)_**

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

| Option | Default | Description |
| --- | --- | --- |
| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |

### Yields

*   `.debug()` yields the same subject it was given from the previous command.
*   `.debug()` is a query, and it is _safe_ to chain further commands.

## Examples

### Debug

#### Pause with debugger after `.get()`

```
cy.get('a').debug().should('have.attr', 'href')
```

## Rules

### Requirements

*   `.debug()` can be chained off of `cy` or off another command.

### Assertions

*   `.debug()` is a utility command.
*   `.debug()` will not run assertions. Assertions will pass through as if this command did not exist.

### Timeouts

*   `.debug()` cannot time out.

## Command Log

**_Log out the current subject for debugging_**

```
cy.get('.ls-btn').click({ force: true }).debug()
```

The commands above will display in the Command Log as:

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

## See also

*   [Cypress Cloud](https://on.cypress.io/cloud)
*   [`.pause()`](/llm/markdown/api/commands/pause.md)
*   [`cy.log()`](/llm/markdown/api/commands/log.md)
*   [`cy.screenshot()`](/llm/markdown/api/commands/screenshot.md)
