2
的输入字段我有我的DOM如下,如何gettext的()从angularjs应用
<input class="k-textbox ng-pristine ng-untouched ng-valid ng-valid-required" type="text" placeholder="" ng-blur="controller.isDirty=true" ng-change="controller.isDirty=true" ng-model="controller.model.value" ng-required="controller.model.required" ng-disabled="controller.model.readOnly" ng-focus="controller.showFieldHistory(controller)" disabled="disabled">
我想getText()
从上面的输入标签。我尝试了下面的方法,但由于这是一个JSapplication
我无法getText
。虽然文字在DOM
中不可见,但在UI
中对用户可见。
List<WebElement> values = driver.findElements(By.xpath("//input[@ng-model='controller.model.value']"));
for(int i=0;i<values.size();i++)
{
String theTextIWant = values.get(0).getAttribute("ng-model");
System.out.println(theTextIWant);
}
下面是我在执行上面的代码时得到的输出。
controller.model.value
controller.model.value
controller.model.value
从输出我可以说,它只是获取当前值内属性“ng-model”,但不包含在UI
中可见的实际文本。请咨询我如何获得在UI
中可见的文字。
预期的文本:
韦斯利
乔特
优:)这有助于:)谢谢你多:)为此感到高兴:) –