0
0
Cypresstesting~10 mins

cy.check() and cy.uncheck() in Cypress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check the checkbox with id 'subscribe'.

Cypress
cy.get('#subscribe').[1]()
Drag options to blanks, or click blank then click option'
Aclick
Bcheck
Cselect
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Using click() instead of check() may work but is not the best practice.
Using select() or type() which are for other elements.
2fill in blank
medium

Complete the code to uncheck the checkbox with class 'accept-terms'.

Cypress
cy.get('.accept-terms').[1]()
Drag options to blanks, or click blank then click option'
Acheck
Bclear
Cuncheck
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using check() instead of uncheck().
Using clear() which is for input fields.
3fill in blank
hard

Fix the error in the code to check the checkbox with name 'newsletter'.

Cypress
cy.get('input[name="newsletter"]').[1]()
Drag options to blanks, or click blank then click option'
Aclick
Btype
Cselect
Dcheck
Attempts:
3 left
💡 Hint
Common Mistakes
Using click() instead of check().
Using select() or type() which are incorrect here.
4fill in blank
hard

Fill both blanks to check all checkboxes with class 'option' and then uncheck the one with id 'option3'.

Cypress
cy.get('.option').[1]()
cy.get('#option3').[2]()
Drag options to blanks, or click blank then click option'
Acheck
Bclick
Cuncheck
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using click() instead of check() or uncheck().
Using clear() which is not for checkboxes.
5fill in blank
hard

Fill all three blanks to check the checkbox with id 'agree', verify it is checked, and then uncheck it.

Cypress
cy.get('#agree').[1]()
cy.get('#agree').should('[2]')
cy.get('#agree').[3]()
Drag options to blanks, or click blank then click option'
Acheck
Bbe.checked
Cuncheck
Dbe.visible
Attempts:
3 left
💡 Hint
Common Mistakes
Using click() instead of check() or uncheck().
Using should('be.visible') instead of should('be.checked').