--- title: first comments: false --- Get the first DOM element within a set of DOM elements. # Syntax ```javascript .first() .first(options) ``` ## Usage **{% fa fa-check-circle green %} Correct Usage** ```javascript cy.get('nav a').first() // Yield first link in nav ``` **{% fa fa-exclamation-triangle red %} Incorrect Usage** ```javascript cy.first() // Errors, cannot be chained off 'cy' cy.getCookies().first() // Errors, 'getCookies' does not yield DOM element ``` ## Arguments **{% fa fa-angle-right %} options** ***(Object)*** Pass in an options object to change the default behavior of `.first()`. Option | Default | Description --- | --- | --- `log` | `true` | {% usage_options log %} `timeout` | {% url `defaultCommandTimeout` configuration#Timeouts %} | {% usage_options timeout .first %} ## Yields {% helper_icon yields %} {% yields changes_dom_subject .first %} # Examples ## First element **Get the first list item in a list.** ```html