verify a radio button is selected or not
<form>
<input type=”radio” name=”sex” value=”male”>Male<br>
<input type=”radio” name=”sex” value=”female”>Female
</form>
assertTrue(driver.findElement(By.name(“sex”)).isSelected())
the line will verify whether the radio button is selected or not. If selected the test will pass otherwise it will return 0 and assert will fail.
No images available.