Reputation: 233
I want to select this element:
<span class="required" ng-class="{'disabled': saveInProgress}"
input-control="{okCallback:setFieldValue, params:['firstName'],
title:'First Name', value: person.firstName,
validate:{length:100},empty:false}">
<span hs-placeholder="Type First Name" class="ng-binding"></span>
</span>
And this one too:
<span class="required" ng-class="{'disabled': saveInProgress}"
input-control="{okCallback:setFieldValue, params:['lastName'],
title:'Last Name', value: person.lastName, validate:{length:100}}">
<span hs-placeholder="Type Last Name" class="ng-binding">
</span>
</span>
I tried to do so using
var input = element(by.css('span.required span.ng-binding'));
browser.actions().mouseMove(input).click().perform();
But it kept on calling the first name element only. Any ideas? please :)
Upvotes: 1
Views: 806
Reputation: 4832
You need to use
element.all(by.css('span.required span.ng-binding')).get(0) //to access 1st element
element.all(by.css('span.required span.ng-binding')).get(1) //to access 2nd element
because in dom there are two elements available for the selector
by.css('span.required span.ng-binding')
if you use
element(by.css('span.required span.ng-binding'))
then protractor by default will take the first displayed element.
Hope it will solve your problem!
Upvotes: 1