How to get the current contents of a form text element in Selenium

Use the value attribute for an <input> element, and the text property for a <textarea>.

Java

String value = driver.findElement(By.tagName("input")).getAttribute("value");
String text = driver.findElement(By.tagName("textarea")).getText()

Python

value = driver.find_element_by_tag_name("input")).get_attribute("value");
text = driver.find_element_by_tag_name("textarea")).text

C#

string value = driver.FindElement(By.TagName("input")).GetAttribute("value");
string text = driver.FindElement(By.TagName("textarea")).Text;