How to check if the checkbox is already checked ,if so then print only text and if the check box is not checked, then click on the checkbox.
boolean sandboxClientCheckbox = driver.findElement(By.xpath("//div[@class='eplChkBoxWrapper']//label[@id='acChkSandboxClientForLbl']")).isSelected();
System.out.println("Check checkbox value " +sandboxClientCheckbox);
if(sandboxClientCheckbox == true) {
Utils.pauseTestExecution(3);
System.out.println("Checkbox is already checked ");
} else {
driver.findElement(By.id("acChkSandboxClientForLbl")).click();
}
HTML Tag
<div class="eplChkBoxWrapper">==$0
<input type="checkbox" id="acChkSandboxClient" class="eplChkBox">
<label id="acChkSandboxClientForLbl" for="acChkSandboxClient">
::after
</label>
pls help