What is the purpose of getText and getAttribute in Selenium?
The getText() method would return the element’s innerText. This is nothing but the text which might be visible on the page with different sub elements. Every leading and trailing space would be ignored. The getAttribute() method would fetch the right text which the attribute would contain in any HTML document.