Reputation: 45
When I use:
cy.get('b').contains('xdz') // find 1 element
but when I use:
cy.get('b:contains("xdz")') // find 2 elements
Can someone explain me what is the difference?
Upvotes: -1
Views: 208
Reputation: 18634
contains('xdz')
is a cypress command which always yields only the first element containing the text. You can read more about it from this Github Thread.
:contains("xdz")
is a Jquery command and it returns all elements containing the text. You can read more about it from the Jquery Docs.
Upvotes: 0