title: Is there a way in selenium python webdriver to assert that all checkboxes are either checked or unchecked?
body: <p>I'm building a test that checks that status of many checkboxes on a single page.</p>
  
  <p>Is there a way I can use a loop or something similar to assert that they are all either checked or unchecked?  I'm new to python and python webdriver, so I'm not even sure how I would start something like this.  </p>
  
  <p>I've seen answers to similar questions using java, but nothing in python.</p>
  
  <p>Thanks for your help.</p>
  
  <p>@Anzel,  Here's the code I'm using:</p>
  
  <pre><code>checkboxes = driver.find_elements_by_xpath('.//input[@type="checkbox"]')
  [c.is_selected() for c in checkboxes]
  [True, True, False, False, False, False, False, False, False]
  assert all([c.is_selected() for c in checkboxes])
  </code></pre>
  
  <p>And this gets the following error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "test.py", line 71, in test_test
  assert all([c.is_selected() for c in checkboxes])
  AssertionError
  </code></pre>
  
  <p>Thanks for any help.</p>