mercredi 22 février 2017

How to select a particular textbox(with ng-model) in protractor testing

Html Code

   <button ng-click="how(x)">Edit</button>
</div>
<div  ng-show="x.show" ng-model='x.form'>
 <form name="hola">
  Darsh:  <input type='text' ng-model='x.title'>
  </form>
 </li>

I have binded the input elements with objects, to send info to the backend I want to do e2e testing for the same. So I do I select the particular textbox from each element of the array, if I have multiple elements?

Test case in protractor

   var elem=element.all(by.repeater('(i,x) in array')).get(1);
  elem.element(by.css('button[ng-click="how(x)"]')).click();
  var title=element.all(by.repeater('(i,x) in array')).get(1);
   title.element(by.model('x.title')).clear();
  title.element(by.id('x.title')).sendKeys('how');

Aucun commentaire:

Enregistrer un commentaire