I've encountered an issue while using Selenium in Java to retrieve a value from an input field. Here's the HTML snippet that I'm working with:
<input class="form-control input-sm " id="NameInputID" type="text" maxlength="16" name="NameInput" value="TheValueWanted" readonly="">
So far, I have attempted two methods:
driver.findElement(By.id("NameInputID")).getText();
and
driver.findElement(By.id("NameInputID")).getAttribute("value");
Unfortunately, both of these approaches did not return the desired value (blank text). If anyone has any suggestions on how to handle this situation, I would greatly appreciate it!
Thank you!