# Check enabled checkboxes

Watch this example in the video Check The Enabled Checkboxes (opens new window).

<ul>
  <li>
    <input type="checkbox" name="c1" disabled="disabled" />
    <label for="c1">I have a bike</label>
  </li>
  <li>
    <input type="checkbox" name="c2" />
    <label for="c2">I have a car</label>
  </li>
  <li>
    <input type="checkbox" name="c3" />
    <label for="c3">I have a boat</label>
  </li>
</ul>
li {
  list-style-type: none;
}

We can get all the checkboxes, filter out the disabled ones using the attribute selector, then click on each one via cy.click (opens new window)

Better: use the cy.check (opens new window) command

Best: use the jQuery :enabled (opens new window) selector plus the cy.check (opens new window) command

// use the jQuery :checkbox + :enabled selectors
// and the cy.check command
cy.get(':checkbox:enabled').check()
// confirm the number of checked inputs
// using the jQuery :checked selector
cy.get(':checked').should('have.length', 2)

# See also