appium - 如果持续时间较长,如何在 Appium iOS 中添加同时移动的触摸?
问题描述
我的应用程序中有一个UIView
。它接收UITouch
-es,并且对其处理具有相当复杂的逻辑。处理逻辑依赖于 UIKit 触摸界面。
我不知道如何用 和 重现这种TouchAction
情况MultiAction
。有 2 次触摸。touch2启动较晚,持续时间较短:
在瞬间t3
和t4
触摸同时移动,然后触摸2结束,但触摸1仍然移动。
我当前不工作的代码:https ://gist.github.com/gatamar/c7182292a1b54379cc26f3e38c823199
在 UIKit 中,触摸事件如下所示:
touchesBegan: [touch1_t1]
touchesBegan: [touch2_t2]
touchesMoved: [touch1_t3, touch2_t3]
touchesMoved: [touch1_t4, touch2_t4]
touchesEnded: [touch2_t4]
touchesMoved: [touch1_t5]
touchesEnded: [touch1_t5]
Appium 可以做到这一点吗?
可以MultiAction
执行两个非同时触摸吗?
Python Appium Client 中是否有更底层的 API,例如 Selenium、XCUITest?
任何帮助将不胜感激。
解决方案
那好吧。这是在 Java 中使用手势的示例。
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Dimension size = driver.manage().window().getSize();
//get your screen size
Point source = new Point(size.getWidth(), size.getHeight());
//this is resolution of your screen
Sequence pinch = new Sequence(finger, 0);
pinch.addAction(finger.createPointerMove(Duration.ofMillis(0),
PointerInput.Origin.viewport(), source.x / 2, source.y / 2));
pinch.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
pinch.addAction(new Pause(finger, Duration.ofMillis(100)));
pinch.addAction(finger.createPointerMove(Duration.ofMillis(600),
PointerInput.Origin.viewport(), source.x / 3, source.y / 3));
然后你需要perform
通过调用来获得那个序列
driver.perform(Arrays.asList(pinchAndZoom1));
如你所见,你可以修改手势的持续时间,玩弄它,你就会明白它是如何工作的。这里还有一些带有示例的文档。
推荐阅读
- swift - 在一个视图控制器中创建动态collectionview
- amazon-web-services - 如何使用 cloudformation 模板将 Fargate 集群服务与任务定义集成/链接
- traefik - Traefik Healthcheck 显然会导致间歇性 RST
- javascript - 将道具转移到那里后如何重新渲染React Native Component
- http - socketio如何过滤事件(特别是flask-socketio)
- c# - XNA 4.0 C# 限制 FPS
- vba - 对象不支持此属性或方法 - 访问表单 - 找不到错误
- sql-server - 在 vb.net 上登录访问时没有数据时尝试读取无效
- batch-file - 如何在 Jenkins 中执行未被杀死的 Windows 批处理命令?
- javascript - 使用 HOC 返回的组件将属性传递给组件会导致错误