I am using a Firefox WebDriver to test a web application. The web application has a top navigation bar, and some of the elements drop down into a menu when you hover over it.
I would like to click a button in the drop-down menu after hover. I am executing the following code:
WebElement dropDown = driver.findElement(By
.xpath("html/body/header/div/ul/li[6]/span[2]/a"));
WebElement logoutButton = driver.findElement(By
.xpath("html/body/header/div/ul/li[6]/ul/li[2]/a"));
//build and perform the mouseOver with Advanced User Interactions API
Actions builder = new Actions(driver);
builder.moveToElement(dropDown).perform();
Thread.sleep(1000);
logoutButton.click();
But I receive the following error:
Element is not currently visible and so may not be interacted with
Do you know how I can make this drop-down button visible? Is there any hack that I can do to make this work?
------ More Details ------
However, during the sleep, the browser shows the URL information in the bottom left corner of the screen, indicating that the web driver is actually hovering, but the button is not being made visible.