-1

My code

WebElement menu= bd.findElement(By.cssSelector("#main-nav > div.multi-level-nav.reveal-on-click > div > ul.first-level-ul > li:nth-child(1) > a"));
        actions.moveToElement(menu).build().perform();
        System.out.println("mouse hover done");
        Thread.sleep(5000);

It works, but when it comes to the running time on the browser screen the dropdown button is not listed down when doing the mousehover. I practically want to put this into display.

1 Answers1

0

To capture the display of the dropdown button opening up you have to take a screenshot at the appropiate time as follows:

WebElement menu= bd.findElement(By.cssSelector("#main-nav > div.multi-level-nav.reveal-on-click > div > ul.first-level-ul > li:nth-child(1) > a"));
actions.moveToElement(menu).build().perform();
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(".\\Screenshots\\keshu_thilakan.png"));
System.out.println("mouse hover done");
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352