Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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));
like image 353
Jérémie Chazelle Avatar asked Dec 18 '22 21:12

Jérémie Chazelle


2 Answers

isSelected() would do that:

this.expect(element(by.model(el)).isSelected()).to.eventually.be.true;
like image 125
alecxe Avatar answered Mar 29 '23 23:03

alecxe


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

like image 28
nnn Avatar answered Mar 29 '23 23:03

nnn