lundi 5 juin 2017

I want to get inner tag value for the md-autocomplete but I am not able to get text valu , Find code below

HTML:

<md-virtual-repeat-container role="presentation" ng-class="{ 'md-not-found': $mdAutocompleteCtrl.notFoundVisible() }" class="md-autocomplete-suggestions-container md-whiteframe-z1 md-virtual-repeat-container md-orient-vertical ng-hide" ng-hide="$mdAutocompleteCtrl.hidden" ng-mouseup="$mdAutocompleteCtrl.mouseUp()" ng-mouseleave="$mdAutocompleteCtrl.listLeave()" ng-mouseenter="$mdAutocompleteCtrl.listEnter()" md-auto-shrink-min="1" md-auto-shrink="" aria-hidden="true" style="left: 676.483px; min-width: 270.717px; max-width: 941.2px; top: auto; bottom: -147.917px; max-height: 240px; height: 96px;">
<div class="md-virtual-repeat-scroller">
    <div class="md-virtual-repeat-sizer" style="height: 96px;"></div>
    <div class="md-virtual-repeat-offsetter">
        <ul id="ul-3" ng-class="::menuClass" class="md-autocomplete-suggestions">
            <!-- mdVirtualRepeat: item in $mdAutocompleteCtrl.matches -->
            <li md-extra-name="$mdAutocompleteCtrl.itemName" ng-click="$mdAutocompleteCtrl.select($index)" ng-class="{ selected: $index === $mdAutocompleteCtrl.index }" md-virtual-repeat="item in $mdAutocompleteCtrl.matches" class="ng-scope" role="button" tabindex="0">
                <!-- mdAutocompleteParentScope: -->
                <md-autocomplete-parent-scope md-autocomplete-replace="" class="ng-scope">
                    <span md-highlight-text="searchText1"><span class="highlight">110081</span>,Delhi</span>
                </md-autocomplete-parent-scope>
            </li>
            <li md-extra-name="$mdAutocompleteCtrl.itemName" ng-click="$mdAutocompleteCtrl.select($index)" ng-class="{ selected: $index === $mdAutocompleteCtrl.index }" md-virtual-repeat="item in $mdAutocompleteCtrl.matches" class="ng-scope" role="button" tabindex="0">
                <!-- mdAutocompleteParentScope: -->
                <md-autocomplete-parent-scope md-autocomplete-replace="" class="ng-scope">
                    <span md-highlight-text="searchText1"><span class="highlight">110081</span>,Nizampur</span>
                </md-autocomplete-parent-scope>
            </li>
            <!-- ngIf: $mdAutocompleteCtrl.notFoundVisible() -->            
        </ul>
    </div>
</div>

Protractor code:

let foo = $$('.md-autocomplete-suggestions').$$('.highlight');
    expect(foo.getText()).toEqual([',Delhi', ',Nizampur']);

I have tried with above code, but it didn't work.

Is there any way I can text field in a span tag.

Aucun commentaire:

Enregistrer un commentaire