Styrow.dev
Question 15 of 82

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();


📲 Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.