I am trying to take screen shot of the web page showing the tool tip text, but I can only see WebElement text being highlighted after mouse hover, but tool tip is not even shown up on the web page during script execution.
Here is the piece of code, that I am trying to execute. Need help to figure out what am I missing..
public static void main(String[] args) throws InterruptedException, IOException, AWTException
{
String URL = "https://www.rediff.com";
System.setProperty("webdriver.chrome.driver", "C:\\Users\\bhara\\eclipse-workspace\\Drivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get(URL);
driver.manage().window().maximize();
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
String WebElementXpath = "//*[@class='mailicon']";
String toolTipText ;
WebElement ToolTipElement = driver.findElement(By.xpath(WebElementXpath));
Actions act1 = new Actions(driver);
act1.moveToElement(ToolTipElement).build().perform();
Robot robot = new Robot();
Point point;
point = ToolTipElement.getLocation();
int x = point.getX();
int y = point.getY();
robot.mouseMove(x,y);
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("screenshot.png"));
System.out.println( ToolTipElement.getAttribute("title"));
}