There is a check box which is displaying as checked already, now when I inspect it shows with image src. in HTML. When I click on the checkbox, it is getting unchecked or checked.
To verify its state, I have written this code, which always brings false even though the checkbox is selected.
WebElement chBox = driver.findElement(By.xpath
("/html/body/div[3]/div[2]/form/fieldset/div[1]/table/tbody/tr[10]/td/img"));
if (chBox.isSelected()) {
System.out.println("User active check box is already checked");
} else
System.out.println("User active check box is not checked");
}
Why?