How to select nth item inside select element in cypress

Update

As pointed out by @dpstree in the comments, this doesn’t answer the original question. Please see more recent answers for a complete solution.

Original

By using eq

cy.get('tbody>tr').eq(0)    // Yield first 'tr' in 'tbody'
cy.get('ul>li').eq(4)       // Yield fifth 'li' in 'ul'

Leave a Comment