引用没有id,类和元素名称的离子折叠元素

时间:2015-10-20 09:45:01

标签: html selenium-webdriver ionic-framework protractor ui-automation

我在量角器方面并不完美,但我在一些项目中使用过它。在我目前的测试项目中,我遇到过离子手风琴,没有类,ID和元素名称来访问它们。这是下面的狙击代码

    <v-accordion role="tablist" class="vAccordion--default">

  <!-- ngRepeat: abt in about.about --><v-pane class="is-expanded" ng-repeat="abt in about.about" expanded="$first" style="background: white none repeat scroll 0% 0%;" ;="">
  <v-pane-header tabindex="0" aria-selected="true" role="tab"><div ng-transclude="">
        <h4 class="ng-binding" style="margin:15px">
        <i class="ion-ios-glasses-outline" style="color:#3498DB; font-size:25px" &nbps;&nbps;&nbps;&nbps;&nbps;&nbps;=""> </i>
          Vision
        </h4>
        <!-- <i class="icon ion-chevron-right icon-accessory"></i> -->
      <!-- <h2 ng-model ="abt.header"></h2> -->
    </div></v-pane-header><!-- <v-pane ng-repeat="domtax in domestictax.domestictax" expanded="$first"> -->



    <v-pane-content style="max-height: none;" role="tabpanel"><div ng-transclude="">
     <h5 class="ng-binding" style="margin:15px">  Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna. Vestibulum dapibus, mauris nec malesuada fames ac turpis velit, rhoncus eu, luctus et interdum adipiscing wisi.</h5>
      <!-- <h2 ng-model ="abt.content"></h2> -->

      <!-- accordions can be nested :) -->
      <!-- ngIf: abt.subpanes -->
    </div></v-pane-content>
  </v-pane><!-- end ngRepeat: abt in about.about --><v-pane class="" ng-repeat="abt in about.about" expanded="$first" style="background: white none repeat scroll 0% 0%;" ;="">
  <!-- <v-pane ng-repeat="domtax in domestictax.domestictax" expanded="$first"> -->

我需要测试的是,是否显示了伪文本“Curabitur et ligula ...”,其中点击了手风琴文本“Vision”或图标。

2 个答案:

答案 0 :(得分:0)

使用css选择器,阅读god object

基本上选择器将是by.css('v-accordion[role="tablist"]')

答案 1 :(得分:0)

var Acordion = element(by.cssContainingText('v-pane-content', 'Curabitur et ligula'));