Web元素的访问值属性<input>.以下是一个例子:
WebElement inputBox = driver.findElement(By.id("inputBoxId"));
String textInsideInputBox = inputBox.getAttribute("value");
// Check whether input field is blank
if(textInsideInputBox.isEmpty())
{
   System.out.println("Input field is empty");
}
希望能帮助到你!
WebElement ele = driver.findElement(by locator)); //find the text field
if (ele.getAttribute("value").isEmpty()) {
    //Do something if the text field is empty
}
else {
    //Store the value
    String store=ele.getAttribute("value");
}