开始使用量角器测试Angular JS应用程序我想提取应用程序的搜索结果。
为此,我需要遍历转发器“对象中的对象”并提取名称coloumn:
我正在使用此代码:
var result = element.all(by.repeater('object in objects').column('name'))
result.then(function(arr) {
//Traverse the repeater and extract data
for (var i = 0; i < arr.length; ++i) {
arr[i].getText().then(function(text) {
console.log( text);
console.log( arr.length);
});
}
此代码仅显示前6个元素,即使我的搜索结果远远超过6。
输出:
TSK(AGR020J)(000)(AGR020JN00)(000)
40
40
TSK(ASA700J)(000)(ASA700JU00)(000)
40
40
TSK(AGR060J)(000)(AGR060JN00)(000)
40
40
TSK(AGT001H)(000)(AGT001HS20)(000)
40
40
TSK(ANF010J)(000)(ANF010JU00)(000)
40
40
TSK(AGT001H)(000)(AGT001HN20)(000)
40
40
40
40
....
6是我的结果的第一行中的元素数量,我不知道为什么搜索doese不包括剩余的行?
这是HTML temlate:
<div id="jobHolder" class="thumbJobs" style="height: 326px; overflow: hidden;" tabindex="5027">
<div id="job_1" class="job ng-scope" ng-click="showJobHoverInfo($index+1)" ng-repeat=
"object in objects" ng-class="object.jobStyle">
<div id="job_1_viewerEye" class="viewerEye" ng-click=
"viewerEye($event,$index+1, object)" ng-class="object.viewerEyeClass"></div>
<div id="job_1_jobBigPicto" class="jobBigPicto transition_2_opa">
<div id="job_1_jobsSmallPictos" class="jobsSmallPictos transition_2_opa">
<div id="job_1_jobDown" class="jobDown transition_2_opa">
<div id="job_1_jobHoverInfo" class="jobHoverInfo" ng-click=
"hideJobHoverInfo($event,$index+1)" style="left: -100%; top: 272px;"></div>
<div id="job_2" class="job ng-scope" ng-click="showJobHoverInfo($index+1)"
ng-repeat="object in objects" ng-class="object.jobStyle">
<div id="job_2_viewerEye" class="viewerEye" ng-click=
"viewerEye($event,$index+1, object)" ng-class="object.viewerEyeClass">
</div>
<div id="job_2_jobBigPicto" class="jobBigPicto transition_2_opa">
<div id="job_2_jobsSmallPictos" class="jobsSmallPictos transition_2_opa">
<div id="job_2_jobDown" class="jobDown transition_2_opa">
<div id="job_2_jobHoverInfo" class="jobHoverInfo" ng-click=
"hideJobHoverInfo($event,$index+1)" style="left: -100%; top: 272px;">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
抱歉,我认为我粘贴了错误的HTML,您可以在修改后立即看到它: ng-repeat =“对象中的对象”