angular - 如何在量角器中使用占位符获取元素的默认值?
问题描述
如何以角度获取输入中存在的默认文本。
<input _ngcontent-c20=""
autocomplete="off" type="text" disabled="true"
placeholder="Username" class="ng-untouched ng-pristine ng-valid">
文本框中的默认值是“abc”。
如何获得这个值,使用getText()
给出空白值。
PS:我们需要验证这些输入中存在的默认文本。
解决方案
试试下面的
ele = element(by.css('input[placeholder="Username"]'));
ele.getAttribute('value'); //This gets the input field value
希望对你有帮助
推荐阅读
- c++ - 如何在c ++中将数组划分为不同的数组
- javascript - 如何从 HTML 和 Javascript 页面执行 linux 命令?
- php - 获取数组 PHP 的内部部分
- python - Django Suspicious File Operation 连接路径位于基本路径之外
- api - API 如何工作和获取数据?
- jsviews - 使用数据链接获取字符串的长度
- git - 如何撤消意外的 Git Add,然后是 Git Revert?(IntelliJ Idea 中的两个动作)
- c++ - 如何使用 GDB 和 QEMU 调试自定义内核
- java - 解析年份时出现 java.time.format.DateTimeParseException
- swift - SwiftUI:避免在主数据更改时重新创建详细视图