Reputation: 7515
I have a text box which contains hours represented from 1 to 24. Hours are incremented and decremented when we click on Up Arrow and Down Arrows(Hyperlinka) above and below the textboxes.
Here is the code for my textbox.
<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">
I have tried the below code. But no luck.
findElement(By.xpath(properties.getProperty("Hours"))).getAttribute("ng-change");
Can any one help on this.
Upvotes: 2
Views: 7816
Reputation: 473873
Find the input and get the value of value
attribute:
WebElement input = driver.findElement(By.xpath('//input[@ng-model="hours"]'));
System.out.println(input.getAttribute("value"));
Upvotes: 4