1

Rather than using a drag or swipe command in the android debug bridge or AndroidViewClient like this:

device.drag((600,800),(600,1200), 1000) 
device.shell('input touchscreen swipe 600 800 600 1200 1000') 

Is there some way to simulate something like the following?

1. press down on some coordinates (eventType=DOWN)
2. sleep 2 seconds (i.e. keep holding there)
3. move to some other coordinates
2. sleep 2 seconds (i.e. keep holding there)
5. release (eventType=UP)

Basically, you touch, hold there for a few seconds, drag and keep holding there for a few seconds, then release the pad.

4

1 回答 1

0

如果您看一下,AdbClient.longPress()您将看到如何为某些键发送长按事件:

    if name in KEY_MAP:
        self.shell('sendevent %s 1 %d 1' % (dev, KEY_MAP[name]))
        self.shell('sendevent %s 0 0 0' % dev)
        time.sleep(duration)
        self.shell('sendevent %s 1 %d 0' % (dev, KEY_MAP[name]))
        self.shell('sendevent %s 0 0 0' % dev)

您可以为您的情况做类似的事情。要了解您应该编写什么,请执行您提到的同一组事件并使用getevent分析它们。

于 2014-07-01T04:45:19.497 回答