How To Handle Checkbox in Selenium Using Java
- How to select Check box in Selenium Webdriver using java ?
driver.findElement(By.xpath("//span[@class='rct-checkbox']")).click();
System.out.println("Checkbox Selected successfully ");
- How do verify check box is selected in the selenium webdriver ?
WebElement Checkbox=driver.findElement(By.xpath("//span[@class='rct-checkbox']"));
boolean bl=Checkbox.isSelected();
System.out.println(bl);
if (bl==false) {
Checkbox.click();
System.out.println("Check box selected Successfully");
}
else {
System.out.println("checkbox is not selected by defalt ");
}
- How do check that checkbox is enabled or not in selenium?
How to verify check box is enabled or not
WebElement Checkbox=driver.findElement(By.xpath("//span[@class='rct-checkbox']"));
boolean bl=Checkbox.isEnabled();
System.out.println(bl);
if (bl==true) {
Checkbox.click();
System.out.println("Check box selected Successfully");
}
else {
System.out.println("Check box is not enable ");
}
- How to verify checkbox available or not on a webpage using selenium
WebElement Checkbox=driver.findElement(By.xpath("//span[@class='rct-checkbox']"));
boolean bl=Checkbox.isDisplayed();
System.out.println(bl);
if (bl==true) {
Checkbox.click();
System.out.println("Check box selected Successfully");
}
else {
System.out.println("checkbox is not present ");
}
Post a Comment
0 Comments