Why is .contains() used in Cypress?
2 Likes
In Cypress, This command helps you find the right element, so if you have a <a>
, where text is inside a <p>
element, a <a>
will be selected
cy
.contains('Lambdatest') // will select heading
cy
.get('a')
.contains('lambdatest') // will select the element which contains lambdatest
2 Likes