How to perform a mouse hover functionality using Selenium Webdriver?
Test Case is like say, open Yahoo site and there is link (Mail) beside Sign-In. Upon mouse hover
I have used similar code and it works for me. I have also used the following at a few places: browser.executeScript("jQuery('mycss-selector').mouseover();") You will have to use css-selector, instead of xpath.
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().perform();
Try this code:
//Assume driver initialized properly.
WebElement element = driver.findElement(By.id("Element id"));
Locatable hoverItem = (Locatable) element;
Mouse mouse = ((HasInputDevices) driver).getMouse();
mouse.mouseMove(hoverItem.getCoordinates());