如何检查是否使用Protractor,CucumberJS和Chai检查复选框?

时间:2015-12-03 15:38:12

标签: javascript protractor bdd chai cucumberjs

如何检查是否使用Protractor,CucumberJS和Chai检查复选框?

var el = 'myCheckbox';

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

3 个答案:

答案 0 :(得分:8)

isSelected()会这样做:

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

答案 1 :(得分:1)

您应该使用this.expect(element(by.model(el)).isSelected()).to.eventually.be(true);

答案 2 :(得分:-1)

expect(element(by.id("")).isSelected()).toBeFalsy();