I want to check the element next to the label username
to be a span with text certificate uploaded
below is the html
<div class="square">
<label>username</label>
<span>cerfiticate uploaded</span>
</div>
Could someone help me with this? Thanks
I want to check the element next to the label username
to be a span with text certificate uploaded
below is the html
<div class="square">
<label>username</label>
<span>cerfiticate uploaded</span>
</div>
Could someone help me with this? Thanks
Share Improve this question edited Nov 15, 2022 at 14:10 Fraction 13k5 gold badges32 silver badges52 bronze badges asked Nov 15, 2022 at 13:22 user19725419user197254191 Answer
Reset to default 5You can use cy.contains()
like this:
cy.contains('span', 'cerfiticate uploaded');
Or use it with cy.next()
If you want to chain the span with label:
cy.contains('label', 'username')
.next()
// or
//.next('span')
.should('have.text', 'cerfiticate uploaded');
For the original question:
You can use cy.get()
like this:
cy.get('input[placeholder="something"]')
.should('be.disabled');