Reputation: 14026
I've a case where I've to get the text from input
tag which is something like -
<input id="AB_WIN_1" class="text real" type="text" ds="0" style="top:0px; left:167px; width:140px; height:21px;"/>
And the text in that input tag is some text say Hello
But when I use getText
, it returns nothing.
Is there anyway I can get text from input
tag?
Upvotes: 1
Views: 5296
Reputation: 4683
you can use any of the below:
1. element.getAttribute("value")
2. element.getAttribute("innerHTML")
3. element.getAttribute("innerText")
4. element.getText()
5. ((JavascriptExecutor)driver)execute.script("return arguments[0].value",element)
Let me know if this does not helps.
Upvotes: 6
Reputation: 11045
use element.getAttribute("value")
. getText can not extract input value.
Upvotes: 1