mercredi 16 août 2017

Retrieving text out of a tag , with ng repeat and a class attribute gives empty/undefined element using protractor

I have the angular page source code that looks like below.

<ul>
<li class = classname1>
        <a ui-sref="name1()" href="/_">Name1</a>==$0
        </li>
<li class = classname1>
        <a>Name2</a>
        <div class="classname2">
         <!--ng-repeat: dropDown in belownames.getDropdownList('Name2')-->
         <a ng-repeat="dropDown in belownames.getDropdownList('Name2')" ui-sref="Name3Data()"
         class="ng-binding ng-scope" href="Name3Data">Name3</a>
         <!--end ngrepeat: dropDown in n belownames.getDropdownList('Name2')-->
         <a ng-repeat="dropDown in belownames.getDropdownList('Name2')" ui-sref="Name4Data()"
         class="ng-binding ng-scope" href="Name4Data">Name4</a>
         <!--end ngrepeat: dropDown in n belownames.getDropdownList('Name2')-->
         <a ng-repeat="dropDown in belownames.getDropdownList('Name2')" ui-sref="Name5Data()"
         class="ng-binding ng-scope" href="Name5Data">Name5</a>
         <!--end ngrepeat: dropDown in n belownames.getDropdownList('Name2')-->
         </div>
        </li> 
<li class = classname1></li>
<li class = classname1></li>
</ul>>

I want to extract elements/links under each of the a tags namely, 1.Name3 2.Name4 3.Name5

And then click on those links to go insert some data in there.

I have tried using below test in my it block

element.all(by.repeater("dropDown in belownames.getDropdownList('Name2')")).getText().then(function(value){ console.log(value); })

However i get the output as array of null values [ '', '', '' ]

How Do i resolve this? Any help would be appreciated.

Thanks. mnc

Aucun commentaire:

Enregistrer un commentaire