org.openqa.selenium.WebDriverException:支持longPress

时间:2018-02-21 09:13:56

标签: selenium-webdriver appium-ios

我正在尝试使用appium实现滑动功能,但它无法正常工作。

TouchAction touch = new TouchAction(driver);
touch.longPress(50,199).moveTo(50,300).release().perform();

以上代码用于从上到下执行滑动操作。 Appium显示以下日志:

org.openqa.selenium.WebDriverException: Support for longPress(options={"x":50,"y":199})-moveTo(options={"x":50,"y":300})-wait(options={"ms":2000})-release(options={}) gesture is not implemented. Try to use "mobile: *" interface to workaround the issue. Only these gestures are supported:
    doubleTap:      doubletap
        tap(options={"count":2})
    tap:        tap
        tap-release
        press-release
    longPress:      longpress
        longpress-release
        press-wait-release
    drag:       press-wait-moveTo-release
        longpress-moveTo-release
    scroll:         press-moveTo-release
 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

更新 上面的代码适用于纵向,但不适用于横向视图。

1 个答案:

答案 0 :(得分:1)

你可以尝试在长按和移动之间使用睡眠,这样如果需要一段时间它就会得到它。

touch.longPress(50,199);
Thread.sleep(3000);
touch.moveTo(50,300).release().perform();

更新或者您可以手动获取屏幕上地点的坐标,其中元素以横向模式显示,而应用程序处于纵向模式并关联它。横向和纵向模式中的元素,并将两者相关联。)