Tag Archives: checked

Tri-state (Indeterminate) Checkboxes

What is the Tri-state? NY/NJ/CT. JK. Tri-state or indeterminate checkboxes are something i discovered recently. Here they are:


Ran into some trouble with them automating, as the “Indeterminate” state will somewhat misleadingly return a True with a “is_checked” attribute query via Webdriver. Actually I had no idea the 3rd state even exists (or should exist logically). Nonetheless…

Check out http://css-tricks.com/indeterminate-checkboxes/

So there will be 3 states that you should check for in order to determine your state:

First, you need to get a combination of two attributes, “checked” and “indeterminate”

  • [WebElement].get_attribute(‘checked’) –> (True, False)
  • [WebElement].get_attribute(‘indeterminate’) –> (True, None)

From these, you can gather the final state of the 3:

  • Unchecked –> checked == False, indeterminate == None
  • Checked –> checked == True, indeterminate == None
  • Indeterminate –> checked == True, indeterminate == True