Mouse Hover on WebElement using Selenium 2 in Java [duplicate]

两盒软妹~` 提交于 2019-12-04 10:40:18

问题


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

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.


回答1:


This will help you:

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


来源:https://stackoverflow.com/questions/6245690/mouse-hover-on-webelement-using-selenium-2-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!