How can we get a text of a web element using Selenium?

Get command is used to retrieve the inner text of the specified web element. The command doesn't require any parameter but returns a string value. It is also one of the extensively used commands for verification of messages, labels, errors etc displayed on the web pages.


String Text = driver.findElement("Text")).getText();