java - 在 Java 中使用 Selenium 2 将鼠标悬停在 WebElement 上

标签 java hover mouse selenium-webdriver

<分区>

Possible Duplicate:
Is there a proved mouseOver workaround for FirefoxDriver in Selenium2?

我希望能够使用 Java Selenium2 API 将鼠标悬停在 WebElement 上。那可能吗?我正在使用当前的 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 - 在 Java 中使用 Selenium 2 将鼠标悬停在 WebElement 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6245690/

相关文章:

java - JAVA的流什么时候会出现EOFException

java - 带有 InputMismatchException 的 try/catch 创建无限循环

jquery - 菜单项悬停动画所有其他元素不是第一个?

WPF ToolTip在鼠标按下时消失

html - Google Docs 如何将鼠标坐标映射到文本偏移量(用于拖放)?

html - 使用 css 将鼠标滚轮设置为水平滚动

java - java中的同步实例方法

java - 服务线程在启动时终止

html - 将鼠标悬停在 div 内的 <button> 上不工作,在外部工作

javascript - 在 openlayers 2 中使用选择和悬停监听器 - 悬停更改样式