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);
}
}