Question - How can you access the text of a web element?
Answer -
Get command is used to retrieve the text of a specified web element. The command does not return any parameter but returns a string value.
Used for:
- Verification of messages
- Labels
- Errors displayed on the web page
Syntax:
String Text=driver.findElement(By.id(“text”)).getText();