【发布时间】:2014-03-27 11:46:35
【问题描述】:
我正在尝试使用 Android UI Automator 工具双击视图,但没有 API 可以双击。有没有其他方法可以使用 ui automator 双击。
提前致谢。
【问题讨论】:
-
你想双击什么?哪个元素?
-
嗨 Smriti,感谢您的评论。我想双击图像视图,但没有来自 ui automator 的直接 api。但最后我得到了解决方案。我使用 Configurator(developer.android.com/tools/help/uiautomator/Configurator.html) api 配置了事件之间的延迟
-
UiObject selectImage = new UiObject(new UiSelector().className("android.widget.RelativeLayout").index(3));配置器 cc = Configurator.getInstance(); cc.setActionAcknowledgementTimeout(40); selectImage.click(); selectImage.click();
-
@SatyaAttili 建议使用
setActionAcknowledgmentTimeout(40)的方法对我有用。 -
添加
setActionAcknowledgmentTimeout(40)似乎也有助于融合除UiObject.click()之外的其他操作组合。例如,我需要在涉及UiObject.click()后跟UiObject.swipeDown(30)的地图上自动执行放大操作(也可以缩小UiObject.click()后跟UiObject.swipeUp(30)。如果不添加setActionAcknowledgmentTimeout(40),它就无法工作。
标签: android android-uiautomator