繁体   English   中英

如何将鼠标指针移到WebElement上

[英]How to move mouse pointer onto a webelement is selenium webdriver java

在测试HTML-5画布时,我必须将鼠标移到内部画布元素上才能看到。 我现在正在做的是

Robot robot = new Robot();
robot.mouseMove(aX, aY);

光标移动到错误的位置,它移动到屏幕顶部而不是画布上。 我尝试了几种方法,包括

1) robot.mouseMove(webelemnt,intx,inty)支持。

2)Actions builder1= new Actions(driver);
builder1.moveToElement(webelemnt, aX, aY).click().perform();

这显示了错误“元素内的偏移无法滚动到视图:(0,0)”

有人可以建议我。

问候,Sampath

我试图使用Webdriver进行类似的鼠标事件模拟,但有时它无法按预期工作。 如果有可能,可以尝试使用JQuery函数:onmouseover(),onmouseenter(),mouseout()。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM