目前有一个问题试图弄清楚为什么以下元素在尝试单击时抛出错误“TypeError:无法调用未定义的方法'click'”。
browser.driver.sleep(2000);
// Undefined, figure out why it cant get a hold of this
expect(element.all(by.css('[ng-value="account.id"]')).get(0).isPresent()).toBe(true);
element.all(by.css('[ng-value="account.id"]')).get(0).then(function (elm) {
browser.driver.sleep(1000);
elm[0].click();
});
正在查看的元素如下(有多个元素,这就是为什么我调用“.get(0)”来查看它们中的第一个单选按钮):
<div class="row row-center" style="height: 85%;">
<div class="col">
<div class="list card" ng-if="accounts != null">
<div class-="list">
<label class="item item-radio"
ng-repeat="account in accounts" ng-if="account.clippable && account.fundable">
<input type="radio"
ng-model="accountConnection.id"
ng-value="account.id" >
<div class="item-content">
{{ account.meta.name }} ({{ account.meta.number }})
<p>${{ account.balance.current }}</p>
</div>
<i class="radio-icon ion-checkmark"></i>
</label>
</div>
</div>
</div>
</div>