How do I getText from an element in pages?
The text of a visible element and its sub-elements is returned by the getText() method. It ignores the preceding and following spaces. To get an element’s text content, we must first identify it with a locator such as id, class, name, XPath, or CSS, and then apply the getText() method to it.