title: Checking all checkboxes with Selenium
body: <p>I am trying to check all checkboxes on a page similarily to <a href="https://sqa.stackexchange.com/questions/3292/how-to-select-or-check-multiple-checkboxes-in-selenium">https://sqa.stackexchange.com/questions/3292/how-to-select-or-check-multiple-checkboxes-in-selenium</a>. </p>
  
  <p>I try to do this with </p>
  
  <pre><code>checkboxes = driver.find_elements_by_class_name('gwt-CheckBox')
  for checkbox in checkboxes:
      if not checkbox.is_selected():
          checkbox.click()
  </code></pre>
  
  <p>however, all checkboxes give False for <code>is_selected()</code> so the ones that are already selected get switched off and the ones that are not selected get switched on. Below I have an example of the a checked CheckBox class (Library Name) and an unchecked Checkbox class (Paired nominal length).</p>
  
  <p>How can I check if these are already selected? </p>
  
  <pre><code>  &lt;div style="position: relative; display: inline-block; vertical-align: top; float: left;"&gt;
     &lt;span class="gwt-CheckBox"&gt;
      &lt;input id="gwt-uid-27" tabindex="0" type="checkbox" value="on"/&gt;
      &lt;label for="gwt-uid-27"&gt;
       Library name
      &lt;/label&gt;
     &lt;/span&gt;
    &lt;/div&gt;
   &lt;/div&gt;
   &lt;div class="holderFp" style="width: 100%; position: relative; overflow: hidden; display: block;"&gt;
    &lt;div style="position: relative; display: inline-block; vertical-align: top; float: left; width: 25%;"&gt;
     &lt;span class="gwt-CheckBox"&gt;
      &lt;input id="gwt-uid-28" tabindex="0" type="checkbox" value="on"/&gt;
      &lt;label for="gwt-uid-28"&gt;
       Paired nominal length
      &lt;/label&gt;
     &lt;/span&gt;
    &lt;/div&gt;
  </code></pre>