Search code examples
geb

gebish checkbox not getting checked


I have a checkbox as follows:

<input type="checkbox" value="true" name="replaceExisting"></input>

Unfortunately, the following code is NOT causing the checkbox to get checked:

$('checkbox', name:'replaceExisting').value('true')

Any ideas?


Solution

  • The Geb docs on checkboxes are wrong:

        // in the docs; doesn't work.
        $('checkbox', name:'replaceExisting').value('true')
    
        // This works:
        $('input', type:'checkbox', name:'replaceExisting').value('true')
    
        // This works, too:
        $('input', name:'replaceExisting').value('true')