【问题标题】:Alternative ways of swiping in Appium without inputting x and y co-ordinates?在不输入 x 和 y 坐标的情况下在 Appium 中滑动的替代方法?
【发布时间】:2018-08-20 06:39:34
【问题描述】:

我有一个滚动条但希望它找到元素而不必一直输入 x 和 y 坐标有没有办法这样做?

WebElement start = androidDriver.findElement(By.id("........."));
TouchAction action = new TouchAction(androidDriver);
action.longPress(start).moveTo(202,120).release().perform();

【问题讨论】:

    标签: java selenium scroll automation appium


    【解决方案1】:

    如果您有两个元素,则可以使用另一种方式在没有坐标的情况下滚动。从一个元素开始滚动,到另一个元素停止滚动。这看起来像:

    WebElement start = androidDriver.findElement(By.id("id_of_the_start_element"));
    WebElement end = androidDriver.findElement(By.id("id_of_the_end_element"));
    TouchAction action = new TouchAction(androidDriver);
    action.press(start).moveTo(end).release().perform();
    

    【讨论】:

      猜你喜欢
      • 2012-09-16
      • 2017-12-15
      • 1970-01-01
      • 2016-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多