我目前正在尝试将光标移动到一个点 (org.openqa.selenium.Point
),该点已通过检查实时图表上是否出现标记来设置,从中我可以获取不到详细信息,但可以找到的 X 和 Y 坐标。
如何将鼠标悬停在所述点上以打开底层 JavaScript 菜单?
当前代码
//finds marker on the current web page
Point image = page.findImage("C:\\Pictures\\marker.png") ;
//move mouse to this x,y location
driver.getMouse().mouseMove((Coordinates) image);
这不起作用,因为 Point
无法转换为 org.openqa.selenium.interactions.internal.Coordinates
。
最佳答案
为什么在 org.openqa.selenium.interactions.Actions.class 时使用 java.awt.Robot可能会工作正常?就说吧。
Actions builder = new Actions(driver);
builder.keyDown(Keys.CONTROL)
.click(someElement)
.moveByOffset( 10, 25 );
.click(someOtherElement)
.keyUp(Keys.CONTROL).build().perform();
关于java - Selenium Webdriver 将鼠标移动到 Point,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12974488/