angularjs - check field labels are visible and contain the correct text with Protractor -


i'm trying verify field labels visible. i.e. id, date, amount + description.

how can check each < dt > in < dl >

the contained in following < dl > element css class rec-details.

<dl class="dl-horizontal rec-details">  <dt> id </dt>  <dd class="ng-binding"> 1 </dd>   <dt> date </dt>  <dd class="ng-binding"> 28/01/2015 </dd>   <dt> amount (£) </dt>  <dd class="ng-binding"> -7.24 </dd>   <dt> description  </dt>  <dd class="ng-binding"> 12345 </dd>  

so need check within element (with css class rec-details) id, date, amount + description there?

how can done protractor?

thanks

in case, following should work.

var recdetails = element(by.css('.rec-details')); var data = recdetails.all(by.css('dd')); var id = data.get(0).gettext().then(function(idtext) {   return parseint(idtext); }); expect(id).tobe(1);  //similar other data elements 

but in case if have access source code, add css-class each of bindings. example:

<dd class=".rec-details-id ng-binding"> 1 </dd> 

so don't have rely on order of data, , can select element this:

var recdetails = element(by.css('.rec-details')); var id = recdetails.element(by.css('.rec-details-id'))                    .gettext().then(function(idtext) {                      return parseint(idtext);                    }); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -