How to verify tooltip text using Selenium?

How to verify tooltip text using Selenium?

Hello Rhian-lewis,

Tooltips web elements have an attribute of type ‘title’. By fetching the value of the ‘title’ attribute, we can verify the tooltip text in Selenium.

String toolTipText = element.getAttribute("title");