我对 Appium 相当陌生,并尝试使用 UIautomator2 来理解移动手势。官方文档提供了有关如何在存在元素 id 时使用“longClickGesture”的 JAVA 语法。
((JavascriptExecutor) driver).executeScript("mobile: longClickGesture", ImmutableMap.of(
"elementId", ((RemoteWebElement) element).getId()
));
有人可以告诉我当元素 id 不存在并且只有 x 和 y 坐标时如何使用上述语法吗?
我尝试在不同的论坛中搜索,但找不到任何直接答案。
你可以使用
.swipe(x, y, x, y, 300)
# ruby
swipe start_x: 75, start_y: 500, end_x: 75, end_y: 500, duration: 0.8
# python
driver.swipe(start_x=75, start_y=500, end_x=75, end_y=500, duration=800)
// java
driver.swipe(75, 500, 75, 500, 0.8)
并给 x 和 y 相同的位置 这与长按相同。