Similar to Why can I click an input with type=radio of a h:selectOneRadio, but not one of a p:selectOneRadio with Graphene/Selenium? I'd like to know how I can check a p:selectBooleanCheckbox in a functional tests with Arquillian and Selenium/Graphene and wait for it to be checked.
I already figured out
- that in plain HTML the checked state is determined not by the value of the
checkedattribute, but by its presence and that in XHTML (where the attribute needs to be always present) by the valuechecked(nottrueorfalse, but why make a new standard intuitive...), see https://www.w3schools.com/tags/att_input_checked.asp for details. - that the Selenium documentation can be misleading in some cases (I'd say even wrong) since it doesn't distinguish between
""andnullfor example in some cases, likeExpectedConditions.attributeToBe(WebElement, String, String)and doesn't mention it - and then the request to improve it get closed with a hint that the Javadoc is accepted to be wrong because everything is well documented in the W3C web driver spec. - that
WebElement.click(where theWebElementinstance refers to the id ofp:selectBooleanCheckboxworks in a minimal environment, but not in a complex one.
The checkbox is checked when I investigate visually with Firefox after the checkbox is clicked with WebElement.click on the @FindBy(id="mainForm:mainCheckbox") element declared in JSF:
<h:form id="mainForm">
<p:selectBooleanCheckbox id="mainCheckbox"
value="#{managedBeanView.property0}"/>
</h:form>
I tried:
- to investigate the
checkedattribute of the generateddivwhich simply always is present (or maybe not, see trouble with Selenium documentation above) - wait for the
checkedattribute of the nested HTML_inputwhich never the attributecheckedapparently (or maybe not, see above).