Selenium Java - Handling Form Elements
Consider this code snippet:
WebElement checkbox = driver.findElement(By.id("agree"));
if (!checkbox.isSelected()) {
checkbox.click();
}
System.out.println(checkbox.isSelected());
What will be printed if the checkbox was initially unchecked?