Skip to content

Instantly share code, notes, and snippets.

@jiasheng-li089
Forked from sjp38/gist:6202539
Last active July 1, 2019 02:08
Show Gist options
  • Select an option

  • Save jiasheng-li089/191c1f4cc55d52ba08dfe314e2137636 to your computer and use it in GitHub Desktop.

Select an option

Save jiasheng-li089/191c1f4cc55d52ba08dfe314e2137636 to your computer and use it in GitHub Desktop.
Monkeyrunner Code Snippets
#!/usr/bin/env monkeyrunner
import time
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection()
# Touch down screen
device.touch(100, 500, MonkeyDevice.DOWN)
# Move from 100, 500 to 300, 500
for i in range(1, 11):
device.touch(100 + 20 * i, 500, MonkeyDevice.MOVE)
print "move ", 100 + 20 * i, 500
time.sleep(0.1)
# Move from (300, 500 to 200, 500)
for i in range(1, 11):
device.touch(300, 500 - 10 * i, MonkeyDevice.MOVE)
print "move ", 300, 500 - 10 * i
time.sleep(0.1)
# Remove finger from screen
device.touch(300, 400, MonkeyDevice.UP)
adb shell monkey -v -s 50 -p com.watsons.mobile --throttle 300 100000 >> mokey.txt &
@jiasheng-li089
Copy link
Author

android monkey 测试样例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment