Styrow.dev
Question 15 of 64

How to get Text of particular webelement?

Question

How to get Text of particular webelement?

Answer

getText() is used to retrieve the inner text of the specified web element. It returns a string value.

Syntax:

String Text = driver.findElement(By.id(“Text”)).getText();