hny2015
hny2015

Reputation: 257

Hard time having finding element using Css or any other locator in protractor

This is how my Html source looks like

<div class="pam-tile-left">
<div pam-icon="lock-closed input"></div>
</div>
<div class="pam-tile-content">
<gfp-form-password-field class="ng-pristine ng-untouched ng-isolate-scope ng-invalid ng-invalid-required" placeholder="Password" validate="true" required="true" ng-model="password">
<input class="ng-pristine ng-invalid ng-invalid-required ng-touched" type="password" ng-show="!showPassword" ng-model="ngModel" ng-disabled="disabled" required="true" placeholder="Password" name="password" data-validate="true">
<input class="ng-pristine ng-untouched ng-invalid ng-invalid-required ng-hide" type="text" ng-show="showPassword" ng-model="ngModel" ng-disabled="disabled" required="true" placeholder="Password" data-validate="true">
<a data-ng-click="toggleShowPassword(!showPassword)" href="javascript:void(0)">
<div ng-attr-pam-icon=" {{ showPassword ? 'password-hide' : 'password-show' }}" pam-icon="password-show"></div>
</a>
</gfp-form-password-field>

I cannot find a password field to click and enter value, I used element(by.css('.ng-untouched')) but then it doesn't find it as it hasnt been touched, please do help.

Upvotes: 2

Views: 761

Answers (2)

Hans Poppe
Hans Poppe

Reputation: 323

Try:

element(by.model('password')).sendKeys('yourpassword');

Upvotes: 1

hny2015
hny2015

Reputation: 257

Talked to dev and added a main parent tag to the query. It was there from start and reason for multiple elements is that we are using same element in two places on same page but in different main parent tag.

this is how my new query looks like - this.rootElement.$('gfp-form-password-field input[name="password"]');

Upvotes: 0

Related Questions