pau*_*aul 5 selenium offset selenium-webdriver
我在用
builder.moveToElement(element).moveByOffset(x,y).click().build().perform();
Run Code Online (Sandbox Code Playgroud)
在上面的函数中,我不确定 X 和 Y 的值,因此我必须多次运行测试才能找出 X 和 Y 的正确值。
示例:首先我会尝试使用 5、5,然后如果我看到它比 5、10 等更靠右一点。
他们有办法一次性找到它吗?
尝试下面的代码来获取精确的 x 和 y 坐标,然后尝试您的代码
WebElement ele= driver.findElement(By.xpath("x-path"));
Point point = ele.getLocation();
int xcord = point.getX();
int ycord = point.getY();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28952 次 |
| 最近记录: |