'Cypress - How to get third element in order in method CONTAINS?
by.contains('text') - Find the first element containing some text
How can i do something like this? - by.contains('text').eq(3) OR by.contains('text')[3]
These two methods do not work.
Solution 1:[1]
If you want to directly assert the text of the third element then you can use eq(2)
cy.get(selector).eq(2).should('have.text', 'some text')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alapan Das |
