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

Jérémie Chazelle picture Jérémie Chazelle · Dec 3, 2015 · Viewed 10.3k times · Source

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));

Answer

alecxe picture alecxe · Dec 3, 2015

isSelected() would do that:

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