Javascript 自AngularJS 1.4:量角器don';在参数化表中找不到ng bind html by.binding
由于我将AngularJS升级到1.4版本,所以我的量角器测试用例是KO。 测试步骤如下:Javascript 自AngularJS 1.4:量角器don';在参数化表中找不到ng bind html by.binding,javascript,angularjs,protractor,ng-bind-html,Javascript,Angularjs,Protractor,Ng Bind Html,由于我将AngularJS升级到1.4版本,所以我的量角器测试用例是KO。 测试步骤如下: var allRows = element.all(by.repeater('row in displayedElts')); expect(allRows.count()).to.eventually.equal(1); allRows.first().then(function (row) { row.element(by.binding('row.label')).then(function
var allRows = element.all(by.repeater('row in displayedElts'));
expect(allRows.count()).to.eventually.equal(1);
allRows.first().then(function (row) {
row.element(by.binding('row.label')).then(function (elm1) {
...
}
}
<table>
<tbody>
<tr ng-repeat-start="row in displayedElts">
<td ng-repeat="col in tableSpec.columns" ng-bind-html="row[col.field] | cldApply:col.filter"></td>
</tr>
</tbody>
</table>
$scope.tableSpec= {
columns: [
{
field: 'label',
labelKey: 'commons.label',
filter : 'cldNone'
},
...
]
}
错误消息是:
NoSuchElementError: No element found using locator: by.binding("row.label")
html代码如下所示:
var allRows = element.all(by.repeater('row in displayedElts'));
expect(allRows.count()).to.eventually.equal(1);
allRows.first().then(function (row) {
row.element(by.binding('row.label')).then(function (elm1) {
...
}
}
<table>
<tbody>
<tr ng-repeat-start="row in displayedElts">
<td ng-repeat="col in tableSpec.columns" ng-bind-html="row[col.field] | cldApply:col.filter"></td>
</tr>
</tbody>
</table>
$scope.tableSpec= {
columns: [
{
field: 'label',
labelKey: 'commons.label',
filter : 'cldNone'
},
...
]
}
过滤器cldApply的代码(如果需要):
过滤器在显示之前应用trustAsHtml清理代码
此代码在升级到AngularJS 1.4之前正常运行
任何线索都将不胜感激,因为我被困在这个案例中。您是否尝试过
by.exactBinding(“row.label”)
替代?感谢您的建议,但结果类似:NoSuchElementError:未找到使用定位器的元素:by.exactBinding(“row.label”)您是否尝试过by.exactBinding(“row.label”)
取而代之的是?感谢您的建议,但结果类似:NoTouchElementError:使用locator:by.exactBinding(“row.label”)找不到元素