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

11,644

Solution 1

isSelected() would do that:

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

Solution 2

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

Share:
11,644
Jérémie Chazelle
Author by

Jérémie Chazelle

My name is Jérémie Chazelle, I'm a web developer.

Updated on June 05, 2022

Comments

  • Jérémie Chazelle
    Jérémie Chazelle almost 2 years

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