【问题标题】:Simulate sliding on specific element (for app) without using pixels在不使用像素的情况下模拟特定元素(对于应用程序)的滑动
【发布时间】:2021-10-03 10:13:30
【问题描述】:

我的应用中有一个元素是滑动条,我想模拟它的滑动。我想知道是否有一种方法可以通过选择一个元素来模拟它,然后按屏幕的百分比滑动它而不是滑动的像素数量。

当前用于模拟滑动的代码:

    TouchAction(driver).tap(x=976, y=810).perform()
    TouchAction(driver).tap(x=102, y=810).perform()
    TouchAction(driver).tap(x=104, y=1259).perform()
    TouchAction(driver).tap(x=974, y=1257).perform()

我不喜欢它的地方:依靠触摸而不是滑动,仅适用于相同尺寸的设备。

【问题讨论】:

    标签: python android selenium-webdriver appium


    【解决方案1】:

    你可以使用:

    TouchAction(driver).longPress(startingX, startingY).moveTo(endingX, endingY).release().perform();
    

    【讨论】:

      猜你喜欢
      • 2020-08-09
      • 2018-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多