Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Selenium从只读文本框获取动态文本_Java_Selenium_Textbox_Selenium Webdriver - Fatal编程技术网

Java 使用Selenium从只读文本框获取动态文本

Java 使用Selenium从只读文本框获取动态文本,java,selenium,textbox,selenium-webdriver,Java,Selenium,Textbox,Selenium Webdriver,我有一个文本框,其中包含从1到24的小时数。当我们单击文本框上方和下方的向上箭头和向下箭头(Hyperlinka)时,小时会增加或减少 这是我的文本框的代码 <input type="text" ng-model="hours" ng-change="updateHours()" class="form-control text-center ng-pristine ng-valid" ng-mousewheel="incrementHours()" ng-readonly="read

我有一个文本框,其中包含从1到24的小时数。当我们单击文本框上方和下方的向上箭头和向下箭头(Hyperlinka)时,小时会增加或减少

这是我的文本框的代码

<input type="text" ng-model="hours" ng-change="updateHours()" 
class="form-control text-center ng-pristine ng-valid" 
ng-mousewheel="incrementHours()" ng-readonly="readonlyInput" 
maxlength="2" readonly="readonly">

任何人都可以在这方面提供帮助。

找到输入并获取
value
属性的值:

WebElement input = driver.findElement(By.xpath('//input[@ng-model="hours"]'));
System.out.println(input.getAttribute("value"));

我得到了这个例外。(org.openqa.selenium.NoSuchElementException:无此类element@Vikram好的,关于
WebElement input=driver.findelelement(By.xpath(properties.getProperty(“Hours”));
?@Vikram页面上有
iframe
frame
标记吗?谢谢。给我2分钟时间,我会保持延迟并检查一下。谢谢
WebElement input = driver.findElement(By.xpath('//input[@ng-model="hours"]'));
System.out.println(input.getAttribute("value"));