The getText()
method is for retrieving a text node between element tags for example:
<p>Something</p>
getText()
will return “Something”
In a textbox typed text goes into the value attribute so you can try something like:
findElement(By.id("someid")).getAttribute("value");
ComboBox
is a bit different. But if you’re using the Select
object you can use the method:
Select selectItem = new Select(findElement(By.id("someid")));
selectItem.getFirstSelectedOption().getText();