导航

关于长按 duration 的问题

Posted on 2017-07-31 23:32  Young哥哥  阅读(184)  评论(0)    收藏  举报

主要是duration这个参数没有被使用 :   "appium.webdriver.common.touch_action.TouchAction"

修改如下:

def long_press(self, el=None, x=None, y=None, duration=1000):
    self._add_action('longPress', self._get_opts(el, x, y, duration))
    return self

def _get_opts(self, element, x, y, duration = None):
    opts = {}
    if element is not None:
        opts['element'] = element.id
    # it makes no sense to have x but no y, or vice versa.
    if x is None or y is None:
        x, y = None, None
    opts['x'] = x
    opts['y'] = y
    if duration is not None:
        opts['duration'] = duration
    return opts