Thursday, September 23, 2010

Webdriver mouseover

To mouseover in webdriver tests use the RenderedWebElement interface hover method.

http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/RenderedWebElement.html


RenderedWebElement actionMenu = (RenderedWebElement) driver.findElement(By.xpath(xpath_action_set));

actionMenu.hover();


RenderedWebElement is used when you need information about how an element is rendered on screen. Not all drivers implement RenderedWebElement.

When testing it pays to keep the mouse out of the way as it can interrupt the mouseover.