Selenium Tooltip Mouseover Example

Selenium Tooltip Mouseover Example


Tooltip is de facto standard nowadays for information sharing in web pages. In Selenium automation activities, we often encounter a scenario to verify tooltip text. So in this tutorial, we will see Selenium tooltip mouseover scenario to verify tooltip text. We will use Java in our example of verifying Google logo’s tooltip.

Tooltip appears on hovering mouse over any element. To simulate this scenario, we will be using Actions Interface of Java. Follow below steps to implement the Selenium tooltip verification.

  • Declare an object of Actions class using below code.
  • Locate Google logo.
  • Use ‘clickAndHold’ method of Actions class to simulate mouse hover action on Google logo.
  • Get tooltip value using ‘getAttribute’ command.
  • After performing all above steps, your tooltip verification method should be displayed as below.
  • Run your Selenium test.

We hope the above example of Selenium tooltip mouseover scenario would be helpful in your automation activities. Let us know how it goes for you in comments.

  1. Ranjith Kumar
    • Ranjith Kumar
  2. Anony

Leave a Reply

Your email address will not be published.