量角器元素全部计数返回零

时间:2017-07-26 08:07:50

标签: angularjs selenium-webdriver protractor angularjs-e2e

以下是我们的html页面内容



<div class="list-container ng-scope" ng-if="nodes.viewType == 'list'">
<table>
<tbody class="ng-scope ng-isolate-scope" ng-repeat="node in nodes.search.results track by node._id" content-list-row="" ct-node="node" access-parent="true" view-source="search">
<tr id="listrow-590828ac3a058f6a908976cc" class="listrow ng-scope" ng-if="!node.isContainer" ng-class="{'editing-tags': editingTags}" ui-draggable="$parent.canDrag()" drag-channel="N" drag="node" draggable="true">
<td class="background_2_pdf" ng-class="('background_'+node.type +'_'+(node.attachments[0].mimeType | mimeTypeToGroup))" width="2px"></td>
<td style="padding: 8px 5px 8px 10px" width="30px" align="center">
<td class="node-name" ng-style="getNameWidth()" style="cursor: pointer; min-width: 250px;" colspan="1" nowrap="">
<td class="hidden-xs ng-scope" ng-if="$parent.viewSource =='search'" style="padding-left: 2px; padding-right: 2px" nowrap="">
<span class="ng-scope" ng-if="$parent.node.search.highlight.n_searchContent">  </span>
         <span class="fa fa-file-text ng-scope" style="color:#618FE7" ng-if="$parent.node.search.highlight.n_searchContent" popover-trigger="mouseenter" uib-popover-html="$parent.node.search.highlight.n_searchContent[0]"></span>
</td>
<td class="hidden-xs ng-scope" style="padding-left: 2px; padding-right: 2px" ng-if="!editingTags && !editingName" nowrap="">
<td class="node-updated hidden-xs ng-binding ng-scope" style="padding-left: 2px; padding-right: 2px" ng-if="!editingTags && $parent.viewSource !=='metadata'" nowrap="">Updated 85 days ago</td>
<td class="node-owner hidden-xs hidden-sm ng-binding ng-scope" style="padding-left: 2px; padding-right: 2px" ng-if="!editingTags && $parent.viewSource !=='metadata'" nowrap="">Sagar Ladwa</td>
<td class="node-date hidden-xs hidden-sm ng-binding ng-scope" style="padding-left: 2px; padding-right: 2px" ng-if="!editingTags && audit.activity === 'create' && $parent.viewSource !=='metadata'" ng-repeat="audit in node.audit" nowrap="">02/05/2017</td>
<td class="node-options ng-scope" ng-if="!editingTags && !editingMetaTags" nowrap="">
</tr>
</tbody>
<tbody class="ng-scope ng-isolate-scope" ng-repeat="node in nodes.search.results track by node._id" content-list-row="" ct-node="node" access-parent="true" view-source="search">
<tbody class="ng-scope ng-isolate-scope" ng-repeat="node in nodes.search.results track by node._id" content-list-row="" ct-node="node" access-parent="true" view-source="search">
<tbody class="ng-scope ng-isolate-scope" ng-repeat="node in nodes.search.results track by node._id" content-list-row="" ct-node="node" access-parent="true" view-source="search">
<tbody class="ng-scope ng-isolate-scope" ng-repeat="node in nodes.search.results track by node._id" content-list-row="" ct-node="node" access-parent="true" view-source="search">
<tbody class="ng-scope ng-isolate-scope" ng-repeat="node in nodes.search.results track by node._id" content-list-row="" ct-
&#13;
&#13;
&#13;

在这个页面中我们有多个tbody。我的要求是从所有tbody获取所有 class =&#34; fa fa-file-text ng-scope&#34; 并进行迭代。我试过以下样本得到元素的数量/长度 但都给出0或没有结果

var list1= element.all(by.css('.fa fa-file-text ng-scope'));
    list1.count().then(function (size){
        console.log('------------------------------'+size);
    });

element.all(by.css('.fa fa-file-text ng-scope')).count().then(function(size){
       console.log('------------------------------'+size);
    });

element.all(by.css('.fa fa-file-text ng-scope')).map(function(files){
        return files;
    }).then(function(files1){
        console.log('------------------------------'+files1.length);
    });

0 个答案:

没有答案