How to get entered text from textbox when value is empty in selenium using java?
Just I am trying to get entered text from the text field when value is empty.
Below is my HTML:
<input type="text" style="width: 203px" value="" maxlength="32" name="firstName"/>
I tried using getAttribute("value") but it didn't work. Please suggest how to do it using selenium webdriver with java.
Also screenshot attached.
When are you trying to get a value? before entering or after entering it in the text field?
WebElement fName=driver.findElement(By.name("firstName")); fName.sendKeys("Admin"); System.out.println(fName.getText());
Above code should return text entered.