Skip to content
CodeKruPro

Check whether a checkbox is selected

Automation taskEasyAsked in: Accenture, Capgemini

"Which state check works on checkboxes, radio buttons and dropdown options?" The selected check. Read the state of two checkboxes without clicking them, so the test only observes.

isSelected() - Check Selection State

isSelected() - Check Selection State

isSelected() checks if a checkbox or radio button is currently selected/checked.

Task:

  1. Navigate to https://testkru.com/Elements/Checkboxes
  2. Check if firstSelect5 (pre-selected) is selected
  3. Check if firstSelect1 (not selected) is selected

Expected output:

firstSelect5 selected: true
firstSelect1 selected: false
Read full tutorial on Codekru