我使用的是FluentLenium。
我试图在我的java测试中模拟一个on_mouse_over。我必须在下拉菜单中选中一些框,这是一个不可见的元素...
我必须将鼠标移到可见的元素上,才能使用FluentLenium中的click()方法。
如何在java中“模拟”on_mouse_over?
谢谢
发布于 2013-06-21 20:15:49
感谢大家的帮助!
我找到了解决方案:
Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.cssSelector("ul.critereFiltrage")).findElement(By.cssSelector("a"))).moveToElement(driver.findElement(By.cssSelector("div.overview")).findElement(By.cssSelector("a"))).click().build().perform();解释如下:
单击要在A标记上转到的第一个moveToElement()项目要打开DropDown菜单,请单击第二个action
()
非常感谢,
发布于 2013-06-20 22:45:00
您需要使用Actions()类。
Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.id("opens_menu"))).moveToElement(driver.findElement(By.id("hidden_element"))).click().build().perform();文档在这里:http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/interactions/Actions.html
https://stackoverflow.com/questions/17215922
复制相似问题