这就是我的Html源代码的样子
<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>
我找不到密码字段来点击并输入值,我使用了元素(by.css('。ng-untouched'))但是它没有找到它,因为它没有被触及,请帮助。< / p>
答案 0 :(得分:1)
尝试:
element(by.model('password')).sendKeys('yourpassword');
答案 1 :(得分:0)
与dev交谈,并在查询中添加了一个主要的父标记。从一开始就存在多个元素的原因是我们在同一页面上的两个地方使用相同的元素但是在不同的主要父标签中。
这是我的新查询的样子 - this.rootElement。$('gfp-form-password-field input [name =“password”]');