Assert checkbox is not checked with nightwatch.js

  • 1 Replies
  • 2810 Views
*

Karen

  • *
  • 17
Assert checkbox is not checked with nightwatch.js
« on: May 04, 2016, 20:32:30 pm »
I tried using attributeEquals() to check if checkbox is enabled but I receive error that 'checked' attribute doesn't exist
Code
browser
...
...
.verify.attributeEquals('#myCheckbox', 'checked', 'false')
.end();

Is there another method to Assert this functionality ?

*

Ruhit

  • *
  • 22
Re: Assert checkbox is not checked with nightwatch.js
« Reply #1 on: May 05, 2016, 22:24:37 pm »
Try running this

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

  'select checkbox' : function (browser) {
    browser
      .url('http://sample.com')
      .verify.visible('input[id="checkboxId"]', 'Checkbox visible')
      .click('input[id="checkboxId"]')
      .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');
        });
      })
      .end();
  }
};

 

Sitemap 1 2 3 4 5 6 7 8