1

我有一个场景,我需要单击图像之间的特定位置。在通过 Firebug 分析时,它显示为图像并将 id 指定为“Panel_”

Actions builder = new Actions(driver); 

// taking mouse to 00   
builder.moveByOffset(0,0).build().perform();

// then clicking on the x y cords of the image. This XY i have taken from one tool.    
builder.moveByOffset(1076,560).click().build().perform();

或者

WebElement target = driver.findElement(By.id("Panel_"));
Actions builder = new Actions(driver);    
int clickAtX = 1076;     
int clickAtY = 560;     
builder.moveToElement(target,clickAtX,clickAtY).click().build().perform(); 

但是两个代码片段都没有帮助我。有时它会说点击页面范围之外。我使用“Mofiki 的坐标查找器”工具来获取 xy 坐标。

有没有其他方法可以做到这一点?

4

0 回答 0