StuperUser
StuperUser

Reputation: 10850

How can one get the value of a text input using Selenium with C#?

Using Selenium for .NET, how can I get the current value from a html input?

It's possible to .GetAttribute() to get the value attribute but this is the html attribute rather than the current value entered into the text box; an approach similar to jQuery's .val() rather than jQuery's .attr().

Upvotes: 27

Views: 36951

Answers (1)

jolySoft
jolySoft

Reputation: 3020

Element.Text didn't work for me. I used element.GetAttribute("value")

Check out this Q&A Setting input textbox text and then retrieving it in Specflow & Selenium

Upvotes: 59

Related Questions