项目中需要双击一个控件,直接定位到消息列表中未读消息,功能类似于微信中,双击微信按钮的效果
实现方式有两种
第一: new TouchAction(AppiumDriver<?> driver).tap(TapOptions.tapOptions()
.withElement(ElementOption.element(MobileElement ele))
.withTapsCount(2)) -->重点是这行代码 规定动作的次数
.perform();
第二:new TouchAction(AppiumDriver<?> driver).press(PointOption.point(x轴坐标,y轴坐 标)).release().perform().press(PointOption.point(x轴坐标,y轴坐标)).release().perform()
用两次press 也可以实现 双击的效果
以上两种方法在Android和Ios上 都可用
appium官网上还有一种发送mobile命令的方式,实现双击,详细描述可参考以下链接,但这种方式只适用于ios