A page contains a list of checkboxes:
<ul>
<li>
<div class="tree-node">
<span class="tree-checkbox tree-checkbox1"></span>
<span class="tree-title">foo</span>
</div>
</li>
<li>
<div class="tree-node">
<span class="tree-checkbox tree-checkbox0"></span>
<span class="tree-title">bar</span>
</div>
</li>
<ul>
Where .tree-checkbox1 renders a checked box, and .tree-checkbox0 renders an unchecked one. In the above sample, foo is checked, and bar isn't.
I've written this module to interact with the checkbox entries:
class CheckboxItem extends Module {
static content = {
label { $(".tree-title").text() }
checkbox { $(".tree-checkbox") }
isChecked { checkbox.hasClass "tree-checkbox1" }
}
}
When I create an CheckboxItem object, I find I can access its label content, as well as checkbox, but attempting to access isChecked yields:
groovy.lang.MissingPropertyException: Unable to resolve isChecked as content for CheckboxItem, or as a property on its Navigator context. Is isChecked a class you forgot to import?
Help?