--- title: first comments: true description: '' --- Get the first DOM element within a set of DOM elements. | | | |--- | --- | | **Returns** | the new DOM element(s) found by the command. | | **Timeout** | `cy.first` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | # [cy.first()](#usage) Reduce the set of matched DOM elements to the first in the set. # Options Pass in an options object to change the default behavior of `cy.first`. **cy.first(*options* )** Option | Default | Notes --- | --- | --- `log` | `true` | whether to display command in command log `timeout` | [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | Total time to retry getting the element # Usage ## Get the first list item in a list. ```html
When clicking on `first` within the command log, the console outputs the following:
# Related
- [last](https://on.cypress.io/api/last)