Selenium WebDriver 4

Check if an element is selected

Medium70 pts~25 min
  • Element state
  • isSelected
Practice app · Workshop Registration

A registration form with text fields, radios, checkboxes, selects and validation.

Test URL
/lab/selenium-check-if-an-element-is-selected

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Read the selection state of radios and checkboxes before and after changing them.

Your task

  1. 1Open TEST_URL and assert #plan-basic is selected and #plan-pro is not.
  2. 2Click #plan-pro and assert it is selected and #plan-basic is not.
  3. 3Assert #terms is not selected, click it, then assert it is.

Acceptance criteria

  • isSelected is used
  • #plan-pro is checked
  • #terms is checked
  • At least 4 assertions pass

Selenium WebDriver 4 · Selenium · Interactions