TestProject Forum
Powered by leading experts in the test automation community

Assert checkbox is not checked with nightwatch.js

I tried using attributeEquals() to check if checkbox is enabled but I receive error that ‘checked’ attribute doesn’t exist

.verify.attributeEquals('#myCheckbox', 'checked', 'false')

Is there another method to Assert this functionality ?

Try running this

module.exports = {
  tags: ['checkbox'],

  'select checkbox' : function (browser) {
      .verify.visible('input[id="checkboxId"]', 'Checkbox visible')
      .element('id', 'checkboxId', function(response) {
        client.assert.ok(response.value.ELEMENT, 'Checkbox response OK');
        client.elementIdSelected(response.value.ELEMENT, function(result){
          client.verify.ok(result.value, 'Checkbox selected');