Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

Cypress – Handling checkboxes

Category: Cypress
//Select a single checkbox
cy.get('.checkbox').check().should('be.checked')

//Unselecting the checkbox
cy.get('.checkbox').uncheck().should('not.be.checked')

//Select multiple checkboxes using common locator
cy.get('.common-checkbox-locator').check().should('be.checked')

//Select the first checkbox
cy.get('.common-checkbox-locator').first().check().should('be.checked')

//Select the last checkbox
cy.get('.common-checkbox-locator').last().check().should('be.checked')

Leave a Reply

Your email address will not be published. Required fields are marked *