--- title: eq comments: true description: '' --- Get a DOM element in an array of elements at the specific index. | | | |--- | --- | | **Returns** | the new DOM element(s) found by the command. | | **Timeout** | `cy.eq` will retry for the duration of the [`defaultCommandTimeout`](https://on.cypress.io/guides/configuration#timeouts) | # [cy.eq( *index* )](#index-usage) Reduce the set of matched DOM elements to the one at the specified index. # [cy.eq( *indexFromEnd* )](#index-from-end-usage) Providing a negative number indicates a position starting from the end of the set, rather than the beginning. # Options Pass in an options object to change the default behavior of `cy.eq`. **cy.eq( *index*, *options* )** **cy.eq( *indexFromEnd*, *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 # Index Usage ## Find the 2nd element within the elements ```html ``` ```javascript cy.get("li").eq(1).should("contain", "siamese") // true ``` # Index Form End Usage ## Find the 2nd from the last element within the elements ```html ``` ```javascript cy.get("li").eq(-2).should("contain", "sphynx") // true ``` # Command Log ## Find the 4th `li` in the navigation ```javascript cy.get(".left-nav.nav").find(">li").eq(3) ``` The commands above will display in the command log as: screen shot 2015-11-27 at 2 11 47 pm When clicking on the `eq` command within the command log, the console outputs the following: screen shot 2015-11-27 at 2 12 03 pm # Related - [first](https://on.cypress.io/api/first) - [last](https://on.cypress.io/api/last)