Search code examples
javascriptautomated-testsdalekjs

Checking a checkbox with dalekjs


This feels like the stupidest question ever asked on SO, but I'm having no luck with things I've tried to check a simple checkbox within a DalekJS test.

So far I have tried clicking it:-

.click('#checky')

I've tried checking it:-

.execute(function() {
    document.getElementById('checky').checked = true;
}

I've tried setting it:-

.setValue('#checky', true)

Which got dalek very upset...

I've tried shouting at it and swearing at it. But no dice. I've looked through the dalek library and there doesn't seem to be an action to suit. So I'm hoping someone will have any suggestions or help...

Please accept my apologies for the lameness of this question...


Solution

  • try this

    $('#checky').prop('checked',true)
    

    or

    document.createElement("checky").setAttribute('checked',true)
    

    tell me what you find out