Scenario: On the Screen once I navigate I have to click on the checkbox the first time only... Next time when I run the script the checkbox should not be unchecked.... but Issue: First Time if the checkbox is not selected it gets selected correctly and works as per the requirement but the second time when I run the script the checkbox gets unselected which should not happen Below is my Script: Can someone pls help
WebElement ischecked = driver.findElement(By.xpath("//div[contains(@class,'ui-selectbooleancheckbox')]/following::div[contains(@class,'ui-chkbox-box')][2]"));
//String ischecked = generatestatisticscheckbox.getAttribute("checked");
if(!ischecked.isSelected())
{
DriverUtil.waitUntilPageLoad(driver, 60);
FormInputsUtil.clickOnCheckBox(driver, AppXPathsConstants.generatehibernatecheckbox);
}
else if(ischecked.isSelected())
{
System.out.println("Navigated to the bottom of the screen");
//DriverUtil.waitUntilPageLoad(driver, 60);
System.out.println("Checkbox: " + ischecked + "is already selected");
}