How to check checkbox in repeater with protractor

安稳与你 提交于 2019-12-07 04:07:42

And trying to check the checkbox like this but when i run the test it does not seem to check it:

That is because you are clicking the repeater item - the div element, but need to click the input child element instead, I suspect.

You can chain the .all() and .element() calls in a single expression:

this.environments.first().element(by.css("input[ng-model$=checked]")).click();
Sudharsan Selvaraj

Try using the below code to click the checkboxes.

var repeaterElement = element.all(by.repeater('environment in vm.assessment.environments'))

repeaterElement.then(function (ElementArray) {
  for(i = 0; i < ElementArray.length; i++) {
    ElementArray[i].all(by.tagName('input')).get(0).click();
    browser.sleep(1000);
  }
})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!