如何通过两个属性

时间:2015-08-31 19:17:46

标签: angularjs protractor angularjs-e2e

我有单选按钮,如何通过ng-model然后ng-value首先获得第二次单击查找:

<input type="radio" ng-model="vm.ist.educationVsInternship" ng-value=false />

<input type="radio" ng-model="vm.ist.educationVsInternship" ng-value=true />

我试过像

这样的东西
element(by.model('vm.ist.educationVsInternship')).all(by.css('[ng-value=true]')).click();

说并且不点击其中任何一个

more than one element found for locator by.model("vm.ist.educationVsInternship") - the first result will be used

和此:

element(by.model('vm.ist.educationVsInternship')).element(by.css('[ng-value=true]')).click();

给出了以下错误消息:

  

失败:找不到使用定位器找到的元素:By.cssSelector(“[ng-value = true]”)

1 个答案:

答案 0 :(得分:1)

您可以组合这样的属性选择器:

$('input[ng-model="vm.ist.educationVsInternship"][ng-value="true"]')