How to Capture Tooltip in Selenium Webdriver

This article will help you to understand How to Capture Tooltip in Selenium Webdriver and how we can verify the same in test.

What is Tooltip or Help text-

Tooltip sometime also known as Help text.

When we  use  mouse hover on some element or click on some element then this tooltip comes.
Capture tooltip in Selenium

 

Example- Example of Gmail, when we create a new account and fill some fields than for elements you will get the warning or help text.

 

How to Capture Tooltip in Selenium Webdriver

Approach to capture tooltip message in Selenium

  • In this example first, open Gmail account.
  • Click on username then tooltip message will appear.
  • Then mouse hover on message
  • Capture that message in a String variable and print.
  • Then use TestNG Assertion to verify messages.

 

Program to implement-How to Capture Tooltip in Selenium Webdriver

 

Output-

 

How to Capture Tooltip in Selenium Webdriver

How to Capture Tooltip in Selenium Webdriver

 

 

Output

How to Capture Tooltip in Selenium Webdriver

 

Thanks for visiting my blog. Please comment in case any issue.

Keep in touch. Have a nice day 🙂

 

9 Comments

  1. Suresh
  2. Paras
  3. Manoj Kumar
    • Raveendra
  4. krishnaveni