title: How to check a p:selectBooleanCheckbox and wait for it to be checked in Graphene/Selenium?
body: <p>Similar to <a href="https://stackoverflow.com/questions/47106401/why-can-i-click-an-input-with-type-radio-of-a-hselectoneradio-but-not-one-of-a">Why can I click an input with type=radio of a h:selectOneRadio, but not one of a p:selectOneRadio with Graphene/Selenium?</a> I'd like to know how I can check a <code>p:selectBooleanCheckbox</code> in a functional tests with Arquillian and Selenium/Graphene and wait for it to be checked.</p>
  
  <p>I already figured out</p>
  
  <ul>
  <li>that in plain HTML the checked state is determined not by the value of the <code>checked</code> attribute, but by its presence and that in XHTML (where the attribute needs to be always present) by the value <code>checked</code> (not <code>true</code> or <code>false</code>, but why make a new standard intuitive...), see <a href="https://www.w3schools.com/tags/att_input_checked.asp" rel="nofollow noreferrer">https://www.w3schools.com/tags/att_input_checked.asp</a> for details.</li>
  <li>that the Selenium documentation can be misleading in some cases (I'd say even wrong) since it doesn't distinguish between <code>""</code> and <code>null</code> for example in some cases, like <code>ExpectedConditions.attributeToBe(WebElement, String, String)</code> and doesn't mention it - and then the request to improve it get closed with a hint that the <a href="https://github.com/SeleniumHQ/selenium/issues/5649" rel="nofollow noreferrer">Javadoc is accepted to be wrong because everything is well documented in the W3C web driver spec</a>.</li>
  <li>that <code>WebElement.click</code> (where the <code>WebElement</code> instance refers to the id of <code>p:selectBooleanCheckbox</code> works in a minimal environment, but not in a complex one.</li>
  </ul>
  
  <p>The checkbox is checked when I investigate visually with Firefox after the checkbox is clicked with <code>WebElement.click</code> on the <code>@FindBy(id="mainForm:mainCheckbox")</code> element declared in JSF:</p>
  
  <pre><code>&lt;h:form id="mainForm"&gt;
      &lt;p:selectBooleanCheckbox id="mainCheckbox"
                               value="#{managedBeanView.property0}"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>I tried:</p>
  
  <ul>
  <li>to investigate the <code>checked</code> attribute of the generated <code>div</code> which simply always is present (or maybe not, see trouble with Selenium documentation above)</li>
  <li>wait for the <code>checked</code> attribute of the nested HTML <code>_input</code> which never the attribute <code>checked</code> apparently (or maybe not, see above).</li>
  </ul>