Monday, August 25, 2014

Hover Over Menu in Mozilla, IE and Chrome

There are two ways to do it

Method 1
String menuhoverlink = "//input[xpath]";
String sublink = '//input[xpath]';
Actions builder = new Actions(driver);
builder.moveToElement(driver.findElementBy(menuhoverlink).build.perform();
driver.findElementBy(sublink).click();

Method 2
IWebElement element = driver.findElement(By.XPath("urelementxpath"));
ILocatable hoverItem = (ILocatable)element;
IMouse mouse = ((IHasInputDevices)driver).Mouse;
mouse.MouseMove(hoverItem.Coordinates);
driver.findElement(By.XPath("submenuelementxpath")).Click();



No comments:

Post a Comment