mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-18 22:28:38 -05:00
1.7 KiB
1.7 KiB
title, comments, description
| title | comments | description |
|---|---|---|
| find | true |
Get the descendents DOM elements of a specific selector.
| Returns | the new DOM element(s) found by the command. |
| Timeout | cy.find will retry for the duration of the defaultCommandTimeout |
cy.find( selector )
Get the descendants of each DOM element in the current set of matched DOM elements within the selector.
Options
Pass in an options object to change the default behavior of cy.find.
cy.find( selector, options )
| Option | Default | Notes |
|---|---|---|
log |
true |
whether to display command in command log |
timeout |
defaultCommandTimeout |
Total time to retry getting the element |
Selector Usage
Get li's within parent
<ul id="parent">
<li class="first"></li>
<li class="second"></li>
</ul>
// returns [<li class="first"></li>, <li class="second"></li>]
cy.get("#parent").find("li")
Command Log
Find the li's within the nav
cy.get(".left-nav>.nav").find(">li")
The commands above will display in the command log as:
When clicking on the find command within the command log, the console outputs the following: