I am trying to assert an element with the value '0' in it but every time I try to use my code I get an error saying that there were no '0' found instead the value was ''.
The HTML element is this:
<span >0</span>
My code is this:
cy.get('span[]').should('have.value','0')
I tried using this:
cy.get('span[]').should('have.value',0)
But did not work. The only thing that worked for me is this:
cy.get('span[]').should('have.value', '')
Here is the full HTML element:
<div ><div>
<span >LIBRARY</span>
<span >1</span>
</div>
</div>
CodePudding user response:
You are nearly there. have.value
asserts the value attribute in your html whereas you are trying to assert the inner text, so have.text
should do the job for you.
cy.get('span[]').should('have.text', '1')
CodePudding user response:
It's the same as you used in your previous question
cy.get('.font-semibold')
.should('have.text', '\n Got questions? Checkout our Quick Start Guide to see how it all works\n ')
You seem to have no trouble with the concept, why now?