Using Jquery in Cypress.io test, how to get the div 'text' value called 'Wildness' from the below html tag. I have tried below in my Cypress test, but it is throwing undefined in console.
const $divText = Cypress.$('.ibxudA .WildnessText-kRKTej').text()
cy.wrap($divText)
.should("eq", "Wildness")
I might try this:
cy.get(".ibxudA").find('.WildnessText-kRKTej').invoke('text').then((text) => {
expect(text.trim()).equal('Wildness')
});
or
cy.get(".ibxudA").find('.WildnessText-kRKTej').should('have.text',"Wildness")
This might be a similar question: How do you check the equality of the inner text of a element using cypress?