title: How to click on multiple checkboxes in selenium webdriver?
body: <p>I'm trying to check multiple Checkbox in a table via reading data from <code>Excel</code>, it is actually able to read data from excel and locate the Checkbox but it does not check/click the checkbox. The ongoingPrecuationsChk.click(); is not working and it does not show any exception(skips execution of the line), can somebody explain to me why it's not checking/clicking the checkbox? Below is my html code:</p>
  
  <pre><code>&lt;table id="ContentPlaceHolder1_ctl04_cbl_CCPOP01_01"&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
       &lt;td&gt;
      &lt;input id="ContentPlaceHolder1_ctl04_cbl_CCPOP01_01_0"
   type="checkbox"
       name="ctl00$ContentPlaceHolder1$ctl04$cbl_CCPOP01_01$0" 
  value=" Universal    "&gt;
  &lt;label for="ContentPlaceHolder1_ctl04_cbl_CCPOP01_01_0"&gt; Universal   &lt;/label&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input id="ContentPlaceHolder1_ctl04_cbl_CCPOP01_01_1" 
  type="checkbox" 
  name="ctl00$ContentPlaceHolder1$ctl04$cbl_CCPOP01_01$1"
   value=" Aspiration  "&gt;
  &lt;label for="ContentPlaceHolder1_ctl04_cbl_CCPOP01_01_1"&gt; Aspiration  &lt;/label&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input id="ContentPlaceHolder1_ctl04_cbl_CCPOP01_01_2" 
  type="checkbox" name="ctl00$ContentPlaceHolder1$ctl04$cbl_CCPOP01_01$2" 
  value=" Respiratory "&gt;
  &lt;label for="ContentPlaceHolder1_ctl04_cbl_CCPOP01_01_2"&gt; Respiratory &lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/tbody&gt;
  </code></pre>
  
  <p>I have tried the following code:</p>
  
  <pre><code>String valueOngoingPrecuations = data.getOngoingPrecuations().get(rowCnt);//data reading from excel(Aspiration,Universal)
              List&lt;WebElement&gt; ongoingPrecuations = driver.findElements(By.xpath("//input[@type='checkbox']"));
              List&lt;String&gt; ongoingPrecuationsList = new ArrayList&lt;String&gt;(
                      Arrays.asList(valueOngoingPrecuations.split(",")));
              for (String ongoingPrecuationsCheck : ongoingPrecuationsList) {
                  for (WebElement ongoingPrecuationsChk : ongoingPrecuations) {
                      if (ongoingPrecuationsChk.getAttribute("value").equalsIgnoreCase(ongoingPrecuationsCheck)) {
                          ongoingPrecuationsChk.click();
  
                      }
                  }
              }
  </code></pre>