Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.36 KB

14.-cypress-checkbox.md

File metadata and controls

45 lines (31 loc) · 1.36 KB

✅ 14. Cypress Checkbox

// click all the checkboxes
cy.get('input[type="checkbox"]').check() 

// click a checkbox with id check
cy.get('#chk').check() 

// click a checkbox with value Cypress
cy.get('input[type="checkbox"]').check('Cypress')

// click the checkboxes with values - Java and Python
cy.get('input[type="checkbox"]').check(['Java', 'Python'])

// click the checkbox having value Java with options
cy.get('.chk').check('Java', options)

// click the checkboxes with values – Java and Python with options 
cy.get('input[type="checkbox"]').check(['Java', 'Python'], options)

// click the checkbox having class check with an option
cy.get('.chk').check({force : true})

// uncheck all the checkboxes
cy.get('input[type="checkbox"]').uncheck()

// uncheck a checkbox with id check
cy.get('#chk').uncheck()

// uncheck the checkbox with value Cypress
cy.get('input[type="checkbox"]').uncheck('Cypress')

// uncheck the checkboxes with values - Java and Python
cy.get('input[type="checkbox"]').uncheck(['Java', 'Python'])

// uncheck the checkbox having value Java with options
cy.get('.chk').uncheck('Java', options)

// uncheck the checkboxes with values – Java and Python with options 
cy.get('input[type="checkbox"]').uncheck(['Java', 'Python'], options)

// uncheck the checkbox having class check with an option 
cy.get('.chk').uncheck({force : true)