使用Java中的Selenium 2将鼠标悬停在WebElement上 [英] Mouse Hover on WebElement using Selenium 2 in Java
本文介绍了使用Java中的Selenium 2将鼠标悬停在WebElement上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
Is there a proved mouseOver workaround for FirefoxDriver in Selenium2?
我希望能够通过Java Selenium2 API将鼠标悬停在WebElement上。那可能吗?
I want to be able to mouse hover a WebElement with the Java Selenium2 API. Is that possible? I am using the current beta 3.
推荐答案
这将帮助您:
WebElement elems=driver.findElement(By.linkText("Custom Development"));//Menu Item
WebElement elems1=driver.findElement(By.xpath("//li[@id='item-465']/a"));//Menu
Actions builder = new Actions(driver);
Actions hoverOverRegistrar = builder.moveToElement(elems1);
hoverOverRegistrar.perform();
elems.click();//at last Menu Item Click
这篇关于使用Java中的Selenium 2将鼠标悬停在WebElement上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文