首页 > 解决方案 > 如何在量角器中使用占位符获取元素的默认值?

问题描述

如何以角度获取输入中存在的默认文本。

<input _ngcontent-c20="" 
autocomplete="off" type="text" disabled="true" 
placeholder="Username" class="ng-untouched ng-pristine ng-valid">

文本框中的默认值是“abc”。

如何获得这个值,使用getText()给出空白值。

PS:我们需要验证这些输入中存在的默认文本。

标签: angularseleniumprotractor

解决方案


试试下面的

ele = element(by.css('input[placeholder="Username"]'));

ele.getAttribute('value');  //This gets the input field value

希望对你有帮助


推荐阅读