Reputation: 1
I need to get value from a disabled text box
This is what I'm tried
WebElement text= driver.findElement(By.id("text"));
System.out.println("text= " +ssn.getAttribute("value"));
<input _ngcontent-c10="" class="form-control ng-untouched ng-pristine" id="text" name="TEXT" placeholder="12345" type="text" disabled="">
It is printing this
text = null
Upvotes: 0
Views: 111
Reputation: 7563
Your input
element has no value
attribute, so .getAttribute("value"));
is useless
Your element have the following attribute :
May this is what you mean :
WebElement text = driver.findElement(By.xpath("//input[@id='text']"));
System.out.println("text= " +text.getAttribute("placeholder"));
It will get 12345
Upvotes: 1