The blog gives you idea of testing and automation testing example of selenium webdriver,SQl and Jmeter, you see the basic example of selenium web driver and get idea how to do automation testing,

How to Verify Checked & Unchecked of check-Box Using selenium Webdriver

Checkbox are an often used element in the web application, But how do you work with them in selenium web driver or automation testing.
I am doing an automation testing of one application and I am facing one scenario to verify Check-box are checked or not using automation code

Solution :
There are two ways to approach this first one check if an element has a checked attribute or not, Checked attribute you can check in fire-bug for particular checkbox(a.k.a. performing an attribute lookup), another one by asking an element has been selected or not, you can check selected or isselected using webdriver inbuilt method


Below is CSS code to verify checked and unchecked attribute:


  unchecked
  checked

Java Code :

public void VerifyChkbox(WebElement chkbox){
boolean checkstatus;
checkstatus=chkbox.isSelected();
if (checkstatus==true){
System.out.println("Checkbox is already checked");  
       }
else
     {
chkbx1.click();
System.out.println("Checked the checkbox");
     }
}

Same code is applicable for unchecked


Powered by Blogger.