Search code examples
androidandroidviewclient

Scrolling List using Android View Client(DTmilano)


I am looking forward to scroll a list with the help of Android view client(dtmilano) .The list has 109 elements and only 10 are visible. So i need to scroll down and again perform vc.dump . Kindly guide with a sample python code to perform scroll down operation. Thanks


Solution

  • You should use MonkeyDevice.drag() and your script would look something like this

    list = vc.findViewByIdOrRaise(someid)
    (x, y, w, h) = list.getPositionAndSize()
    start = (int(x+w/2.0), y+h)
    end = (int(x+w/2.0), y)
    # scroll 5 times
    for i in range(5):
        vc.device.drag(start, end, 1.0, 10)