How can I get the inner text of an element in Selenium?

java, selenium, selenium-webdriver

Solution

Try this:

WebElement element = driver.findElement(By.id("id value"));  
String val = element.getAttribute("innerText")

Problem

I'm working with a DOM node: ``` <input type="form-control" type="text" data-bind="textInput: EnterpriseId" disabled autocomplete="off"> ``` How can I get its value? I'm struggling since `element.getText()` does not work and returns a blank.

Original source

Related problems