Cypress · Junior · Question 47 of 75

How do you get the second item from a list?

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.

Further reading

Problem with a question

Cypress · Junior · question 47

Test yourself

Take the Cypress · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz