选项卡未在量角器中单击

时间:2015-09-23 11:11:27

标签: javascript html angularjs selenium protractor

这是我的标签部分的完整HTML

[{date:'Adate', messages:[]},{date:'Adate2',messages:[]}]

在spec.js

<tab heading="Meta Data" id="heading_meta-data">
                                <div id="meta-data" class="row">

                                <div class="col-md-3 col-xs-3">
                                <!-- output -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">Sensor Output</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="outputCollapsed" ng-click="outputCollapsed=!outputCollapsed"><i ng-show="!outputCollapsed" class="fa fa-plus"></i><i ng-show="outputCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="outputCollapsed" class="box-body">
                                   <!-- show ouput fields here -->
                                   <!-- output field box starts here -->


                                <div ng-repeat="outpt in sensorDetails.metaData.output" class="box box-default">

                                 <div class="box-header with-border">
                                   <h6 class="box-title">{{outpt.name}}</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="ocollapsed" ng-click="ocollapsed=!ocollapsed"><i ng-show="!ocollapsed" class="fa fa-plus"></i><i ng-show="ocollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="ocollapsed" class="box-body">
                                   <!-- ouput fields details -->
                                   <ul>

                                <li><b>name</b> : <small>{{outpt.name}}</small></li>

                                <li><b>type </b> : <small>{{outpt.type}}</small></li>

                                <li><b>unit </b> : <small>{{outpt.unit}}</small></li>
                                   </ul>
                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                   <!-- output field box ends here -->


                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                <div class="col-md-3 col-xs-3">
                                <!-- parameter -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">parameter</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="parameterCollapsed" ng-click="parameterCollapsed=!parameterCollapsed"><i ng-show="!parameterCollapsed" class="fa fa-plus"></i><i ng-show="parameterCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="parameterCollapsed" class="box-body">


                                <!-- parameter field box starts here -->


                                <div ng-repeat="param in sensorDetails.metaData.parameter" class="box box-default">

                                 <div class="box-header with-border">
                                   <h6 class="box-title">{{param.name}}</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="pcollapsed" ng-click="pcollapsed=!pcollapsed"><i ng-show="!pcollapsed" class="fa fa-plus"></i><i ng-show="pcollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="pcollapsed" class="box-body">
                                   <!-- ouput fields details -->
                                   <ul>

                                <li><b>name</b> : <small>{{param.name}}</small></li>

                                <li><b>value</b> : <small>{{param.value}}</small></li>

                                <li><b>type </b> : <small>{{param.type}}</small></li>

                                <li><b>unit </b> : <small>{{param.unit}}</small></li>
                                   </ul>
                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->

                                <!-- parameter field box ends here -->


                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                <div class="col-md-3 col-xs-3">
                                <!-- identifier -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">identifier</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="identifierCollapsed" ng-click="identifierCollapsed=!identifierCollapsed"><i ng-show="!identifierCollapsed" class="fa fa-plus"></i><i ng-show="identifierCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="identifierCollapsed" class="box-body">


                                <!-- identifier field box starts here -->


                                <div ng-repeat="iden in sensorDetails.metaData.identifier" class="box box-default">

                                 <div class="box-header with-border">
                                   <h6 class="box-title">{{iden.name}}</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="icollapsed" ng-click="icollapsed=!icollapsed"><i ng-show="!icollapsed" class="fa fa-plus"></i><i ng-show="icollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="icollapsed" class="box-body">
                                   <!-- ouput fields details -->
                                   <ul>

                                <li><b>name</b> : <small>{{iden.name}}</small></li>

                                <li><b>value</b> : <small>{{iden.value}}</small></li>

                                <li><b>type </b> : <small>{{iden.type}}</small></li>

                                <li><b>unit </b> : <small>{{iden.unit}}</small></li>
                                   </ul>
                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->

                                <!-- identifier field box ends here -->

                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                <div class="col-md-3 col-xs-3">
                                <!-- classifier -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">classifier</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="collapsed" ng-click="classifierCollapsed=!classifierCollapsed"><i ng-show="!classifierCollapsed" class="fa fa-plus"></i><i ng-show="classifierCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="classifierCollapsed" class="box-body">

                                 <!-- classifier field box starts here -->


                                <div ng-repeat="classi in sensorDetails.metaData.classifier" class="box box-default">

                                 <div class="box-header with-border">
                                   <h6 class="box-title">{{classi.name}}</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="pcollapsed" ng-click="ccollapsed=!ccollapsed"><i ng-show="!ccollapsed" class="fa fa-plus"></i><i ng-show="ccollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="ccollapsed" class="box-body">
                                   <!-- classifiers fields details -->
                                   <ul>

                                <li><b>name</b> : <small>{{classi.name}}</small></li>

                                <li><b>value</b> : <small>{{classi.value}}</small></li>

                                <li><b>type </b> : <small>{{classi.type}}</small></li>

                                <li><b>unit </b> : <small>{{classi.unit}}</small></li>
                                   </ul>
                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->

                                <!-- classifier field box ends here -->

                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                <div class="col-md-3 col-xs-3">
                                <!-- capability -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">capability</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="collapsed" ng-click="capabilityCollapsed=!capabilityCollapsed"><i ng-show="!capabilityCollapsed" class="fa fa-plus"></i><i ng-show="capabilityCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="capabilityCollapsed" class="box-body">



                                <!-- capability field box starts here -->


                                <div ng-repeat="capab in sensorDetails.metaData.capability" class="box box-default">

                                 <div class="box-header with-border">
                                   <h6 class="box-title">{{capab.name}}</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="cacollapsed" ng-click="cacollapsed=!cacollapsed"><i ng-show="!cacollapsed" class="fa fa-plus"></i><i ng-show="cacollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="cacollapsed" class="box-body">
                                   <!-- classifiers fields details -->
                                   <ul>

                                <li><b>name</b> : <small>{{capab.name}}</small></li>

                                <li><b>value</b> : <small>{{capab.value}}</small></li>

                                <li><b>type </b> : <small>{{capab.type}}</small></li>

                                <li><b>unit </b> : <small>{{capab.unit}}</small></li>
                                   </ul>
                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->

                                <!-- capability field box ends here -->

                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                <div class="col-md-3 col-xs-3">
                                <!-- characteristics -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">characteristics</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="characteristicsCollapsed" ng-click="characteristicsCollapsed=!characteristicsCollapsed"><i ng-show="!characteristicsCollapsed" class="fa fa-plus"></i><i ng-show="characteristicsCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="characteristicsCollapsed" class="box-body">



                                <!-- characteristics field box starts here -->


                                <div ng-repeat="char in sensorDetails.metaData.characteristics" class="box box-default">

                                 <div class="box-header with-border">
                                   <h6 class="box-title">{{char.name}}</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="chcollapsed" ng-click="chcollapsed=!chcollapsed"><i ng-show="!chcollapsed" class="fa fa-plus"></i><i ng-show="chcollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="chcollapsed" class="box-body">
                                   <!-- classifiers fields details -->
                                   <ul>

                                <li><b>name</b> : <small>{{char.name}}</small></li>

                                <li><b>value</b> : <small>{{char.value}}</small></li>

                                <li><b>type </b> : <small>{{char.type}}</small></li>

                                <li><b>unit </b> : <small>{{char.unit}}</small></li>
                                   </ul>
                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->

                                <!-- characteristics field box ends here -->


                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                <div class="col-md-3 col-xs-3">
                                <!-- interface -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">interface</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="interfaceCollapsed" ng-click="interfaceCollapsed=!interfaceCollapsed"><i ng-show="!interfaceCollapsed" class="fa fa-plus"></i><i ng-show="interfaceCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="interfaceCollapsed" class="box-body">



                                <!-- interface field box starts here -->


                                <div ng-repeat="intrface in sensorDetails.metaData.capability" class="box box-default">

                                 <div class="box-header with-border">
                                   <h6 class="box-title">{{intrface.name}}</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="incollapsed" ng-click="incollapsed=!incollapsed"><i ng-show="!incollapsed" class="fa fa-plus"></i><i ng-show="incollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="incollapsed" class="box-body">
                                   <!-- interface fields details -->
                                   <ul>

                                <li><b>name</b> : <small>{{intrface.name}}</small></li>

                                <li><b>value</b> : <small>{{intrface.value}}</small></li>

                                <li><b>type </b> : <small>{{intrface.type}}</small></li>

                                <li><b>unit </b> : <small>{{intrface.unit}}</small></li>
                                   </ul>
                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->

                                <!-- interface field box ends here -->


                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                <div class="col-md-3 col-xs-3">
                                <!-- position global -->
                                <div class="box box-default">
                                 <div class="box-header with-border">
                                   <h6 class="box-title">position global</h6>
                                   <div class="box-tools pull-right">
                                     <button class="btn btn-box-tool" ng-model="positionGlobalCollapsed" ng-click="positionGlobalCollapsed=!positionGlobalCollapsed"><i ng-show="!positionGlobalCollapsed" class="fa fa-plus"></i><i ng-show="positionGlobalCollapsed" class="fa fa-minus"></i></button>

                                   </div><!-- /.box-tools -->
                                 </div><!-- /.box-header -->
                                 <div ng-show="positionGlobalCollapsed" class="box-body">


                                <ul>

                                <li><b>altitude</b> : <small>{{sensorDetails.metaData.position_global.altitude}}</small></li>

                                <li><b>latitude</b> : <small>{{sensorDetails.metaData.position_global.location.lat}}</small></li>

                                <li><b>longitude </b> : <small>{{sensorDetails.metaData.position_global.location.lon}}</small></li>

                                </ul>

                                 </div><!-- /.box-body -->
                                </div><!-- /.box -->
                                </div>
                                </div>
                                </tab>

此处标签未被点击..............

请告诉可能是什么问题............. ??????????

已经增加了浏览器等待时间但仍然没有帮助................................. ???? ?????

1 个答案:

答案 0 :(得分:0)

使用wait()函数等待DOM中Tab的存在,然后在找到元素后尝试单击它。如果要显示的元素花费的时间更长,则在wait()函数中增加超时。这是如何 -

var metaData = element(by.id('heading_meta-data'));
browser.wait(protractor.ExpectedConditions.visibilityOf(metaData), 10000)
.then(function(){
    metaData.click();
});

希望这有帮助。