0

I want to capture the tooltip of Business menu using Selenium JAva..I used javascript and action class to mouse over, but failed to capture the tooltip... Below is my part of code..Any help is appreciated...

the web is "https://www.rediff.com/news"..Sel

By tooltip = By.xpath("/html/body/div[5]/div[1]/ul/li[3]/a");
        String TP_realtime = driver.findElement(tooltip).getAttribute("title");
        System.out.println("Tooltip is " + TP_realtime );
        
        WebElement realtime = driver.findElement(tooltip);

        js.executeScript("arguments[0].scrollIntoView();", realtime);
        Thread.sleep(1000);
        action.moveToElement(realtime).build().perform();
        Thread.sleep(6000);
        utils.HelperFunctions.captureScreenShot(driver, filename2);
JeyanthiRanjit
  • 161
  • 1
  • 12
  • The only way I was ever able to capture menu/tooltips is to have a delay( while you setup the scene) and do a full screen capture. Then you can crop the picture to what you want. I did not try the code you are using. – cliff2310 Sep 06 '20 at 16:57
  • @JeyanthiRanjit Were you able to make the tool tip visible before taking the screenshot? – undetected Selenium Sep 06 '20 at 19:41
  • Yes @DebanjanB.. I can capture it using prt SC and paste it in paint.. it shows tooltip text... – JeyanthiRanjit Sep 07 '20 at 01:35
  • You can simulate PRT SC press with Robot: https://stackoverflow.com/questions/19048119/how-to-simulate-print-screen-button-using-selenium-webdriver-in-java – Mate Mrše Sep 11 '20 at 14:23

0 Answers0