I’m recently using cypress and I want to get the array of list but I just want the to get <li>
under the class “list” and not including the other children of <li>
I’m using
cy.get('.list >li')
but I’m also getting the children <li>
under Home.
<ul class="list">
<li>Home</li>
<ul>
<li>Another One</li>
<li>Another Two</li>
</ul>
<li>Page</li>
<li>Hello</li>
<li>Hi</li>
</ul>
you have two ways to do this
cy.get('.list').children('li')