Reputation: 20078
How would I extract the text from the input filed? I tried using XPath/CSSSelector but I'm getting an empty text and since its a input field.
Here is my html code:
<div>
<input type="text" style="width:110px;" class="display">
</div>
Result: 1 to 50 of 195 rows
Here is the screen shot of the input field:
Upvotes: 3
Views: 13181
Reputation: 20078
I'm using C# so here is the working complete code:
public string TextAttributeValueByCssSelector(By by)
{
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(30));
return wait.Until(drv => drv.FindElement(by)).GetAttribute("value");
}
Upvotes: 1
Reputation: 9569
You need to get the field's value. For example: element.get_attribute("value")
Upvotes: 16