这个长按是指长按 element,在其他语言的 client 上我不知道是否有个问题

现在已经 merged 了,可以更新下直接用:https://github.com/appium/python-client

说一下之前不好用的原因,主要是 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


↙↙↙阅读原文可查看相关链接,并与作者交流