Cypress · Junior · Question 47 of 75
How do you get the second item from a list?
- 1
cy.get('li').second() - 2
cy.get('li')[1] - 3
cy.get('li').eq(1)
Show the answer
Correct answer: cy.get('li').eq(1)
Explanation
.eq() is zero-based; .first() and .last() are shortcuts. Filtering by content is often more robust than position.