---
id: api/commands/siblings
title: siblings | Cypress Documentation
description: Get sibling DOM elements in Cypress.
section: api
source_path: docs/api/commands/siblings.mdx
version: 1375fa62d5875962138c8c43f27d7e1235a504a5
updated_at: '2026-04-29T19:28:48.012Z'
---
# siblings

Get sibling DOM elements.

## Syntax

```javascript
.siblings()
.siblings(selector)
.siblings(options)
.siblings(selector, options)
```

### Usage

 **Correct Usage**

```javascript
cy.get('td').siblings() // Yield all td's siblings
cy.get('li').siblings('.active') // Yield all li's siblings with class '.active'
```

 **Incorrect Usage**

```javascript
cy.siblings('.error') // Errors, cannot be chained off 'cy'
cy.clock().siblings() // Errors, 'clock' does not yield DOM elements
```

### Arguments

 **selector *(String selector)***

A selector used to filter matching DOM elements.

 **options *(Object)***

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

| Option    | Default                                                                           | Description                                                                                         |
| --------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `log`     | `true`                                                                            | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |
| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.siblings()` to resolve before [timing out](#Timeouts)                            |

### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)

- `.siblings()` yields the new DOM element(s) it found.
- `.siblings()` is a query, and it is *safe* to chain further commands.

## Examples

### No Args

#### Get the siblings of each li

```html
<ul>
  <li>Home</li>
  <li>Contact</li>
  <li class="active">Services</li>
  <li>Price</li>
</ul>
```

```javascript
// yields all other li's in list
cy.get('.active').siblings()
```

### Selector

#### Get siblings of element with class active

```javascript
// yields <li class="active">Services</li>
cy.get('li').siblings('.active')
```

## Rules

### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)

- `.siblings()` requires being chained off a command that yields DOM element(s).

### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)

- `.siblings()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md)
  until the element(s)
  [exist in the DOM](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Implicit-Assertions).
- `.siblings()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md)
  until all chained assertions have passed.

### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)

- `.siblings()` can time out waiting for the element(s) to
  [exist in the DOM](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Implicit-Assertions).
- `.siblings()` can time out waiting for assertions you've added to pass.

## Command Log

***Get the siblings of element with class `active`***

```javascript
cy.get('.left-nav').find('li.active').siblings()
```

The commands above will display in the Command Log as:

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

## History

| Version                                                    | Changes                     |
| ---------------------------------------------------------- | --------------------------- |
| [< 0.3.3](/llm/markdown/app/references/changelog.md#0-3-3) | `.siblings()` command added |

## See also

- [`.prev()`](/llm/markdown/api/commands/prev.md)
- [`.next()`](/llm/markdown/api/commands/next.md)
