如何在robotframework中自定义appium的手势

当在robotframework中使用appium时,由于AppiumLibrary中没有手势操作方法,所以需要自定义一下方法

步骤:

1、在AppiumLibrary源码中找到这个类class _TouchKeywords(KeywordGroup):

如何在robotframework中自定义appium的手势

2、在类中添加如下方法:

#自定义methods
def draw_gesture_one_time(self, *args):
    driver = self._current_application()
    TouchAction(driver).press(args[0]).move_to(args[0]).move_to(args[3]).wait(150).move_to(args[6]).wait(150).move_to(args[8]).wait(150).release().perform()


这样就可以在RF中调用该方法,传入手势界面的元素,完成手势的操作了。


如何在robotframework中自定义appium的手势