Search code examples
javascriptprotractorbddchaicucumberjs

How can I check if checkbox is checked with Protractor, CucumberJS and Chai?


How can I check if checkbox is checked with Protractor, CucumberJS and Chai ?

var el = 'myCheckbox';

this.expect(element(by.model(el)).to.have.prop("checked", true));

Solution

  • isSelected() would do that:

    this.expect(element(by.model(el)).isSelected()).to.eventually.be.true;