JS Testing Academy · QA Demo Site

Radio Button

Three radio buttons – one of them is disabled, which is the case people forget to test.

Do you like this demo site?

Practice tasks

  1. Select Yes and assert the result text reads You selected Yes.
  2. Select Impressive and assert the result changes, and that Yes is no longer selected.
  3. Assert that the No radio is disabled and cannot be selected (a click must not change the result).
  4. Assert that no radio is selected when the page first loads.
Sample automation code
driver.findElement(By.id("yes-radio")).click();
Assert.assertEquals(driver.findElement(By.id("radio-result")).getText(), "You selected Yes");

WebElement no = driver.findElement(By.id("no-radio"));
Assert.assertFalse(no.isEnabled());