How can I handle verify tooltip in Selenium Webdriver

0 votes
How can I handle/verify tooltip in Selenium Webdriver?
Jul 4, 2019 in Selenium by Amardeep
630 views

1 answer to this question.

0 votes

Hey Amardeep, tooltips are help or info boxes which pops up when you hover mouse on a web element. They are basically used to provide info or help about the specific webelement. You can handle such tooltips by following this code snippet:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;

public class Tool_Tip {

  public static void main(String[] args) {

     System.setProperty("webdriver.gecko.driver", "D:\\geckodriver.exe");

     WebDriver driver = new FirefoxDriver();

     driver.get("https://forums.edureka.co");

     Actions builder = new Actions(driver);

     // find the tooltip xpath
     WebElement arrow_box_tooltip = driver.findElement(By.className("arrow_box"));

     // Mouse hover to that text message
     builder.moveToElement(arrow_box_tooltip).perform();

     // Extract text from tooltip
     String tooltip_msg = arrow_box_tooltip.getText();

     // Print the tooltip message
     System.out.println("Tooltip/ Help message is " + tooltip_msg);
  }
}
answered Jul 5, 2019 by Abha
• 28,140 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How can I capture Tooltip in Selenium Webdriver?

Hey Diljeet, following test script allows you ...READ MORE

answered Jul 19, 2019 in Selenium by Anvi
• 14,150 points
1,756 views
+2 votes
3 answers

How can we handle authentication popup in Selenium WebDriver using Java

1) By passing user credentials in URL. String ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
29,057 views
0 votes
1 answer

How can I create a POM test case in Selenium Webdriver?

Hey Akshay, follow these steps to create ...READ MORE

answered May 13, 2019 in Selenium by Anvi
• 14,150 points
1,471 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,649 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,131 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,209 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,865 views
0 votes
1 answer

How can I add Cucumber Jar files in Eclipse to use with Selenium Webdriver?

Hey Eshan, follow these steps to add ...READ MORE

answered May 23, 2019 in Selenium by Abha
• 28,140 points
5,975 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP