[英]How to check if the checkbox is checked or not in protractor using javascript
[英]How can I check if checkbox is checked with Protractor, CucumberJS and Chai?
如何檢查 Protractor、CucumberJS 和 Chai 是否選中了復選框?
var el = 'myCheckbox';
this.expect(element(by.model(el)).to.have.prop("checked", true));
isSelected()
會這樣做:
this.expect(element(by.model(el)).isSelected()).to.eventually.be.true;
你應該使用this.expect(element(by.model(el)).isSelected()).to.eventually.be(true);
expect(element(by.id("")).isSelected()).toBeFalsy();
我嘗試了以下代碼並通過了。
期望(元素(by.css(“”))。get(i)。isSelected())。toBeFalsy();
其中,i對應需要測試的checkbox
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.