Skip to content

Instantly share code, notes, and snippets.

@pboos
Last active December 20, 2015 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pboos/6152704 to your computer and use it in GitHub Desktop.
Save pboos/6152704 to your computer and use it in GitHub Desktop.
monkeyrunner
# For setup:
# adb -d forward tcp:1080 tcp:1080
# adb -d shell monkey --port 1080
import sys
import time
import telnetlib
tn = telnetlib.Telnet("localhost", 1080, 5)
# Horizontal scroll right
while True:
tn.write("touch down 500 200\r\n")
time.sleep(0.2)
tn.write("touch move 300 200\r\n")
time.sleep(0.2)
tn.write("touch up 300 200\r\n")
time.sleep(0.2)
tn.write("sleep 1000\r\n")
time.sleep(1)
# Vertical scroll down
# while True:
# tn.write("touch down 200 500\r\n")
# tn.write("touch move 200 300\r\n")
# tn.write("touch up 200 300\r\n")
# tn.write("sleep 3000\r\n")
# time.sleep(3)
tn.close
adb forward tcp:1080 tcp:1080
adb shell monkey --port 1080
telnet localhost 1080
# swipe left
touch down 200 500
touch move 300 500
touch move 400 500
touch move 500 500
touch up 600 500
sleep 1000
# folder
tap 119 893
sleep 2000
# app
tap 236 885
sleep 30000
# galaxy
tap 620 600
sleep 10000
# nebula system (on star map)
tap 960 195
sleep 10000
# explore button
tap 625 485
sleep 6000
# + 1 fighter
tap 330 500
sleep 1000
# send flagship (off)
tap 750 600
sleep 1000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
#####################
## from here it is repeating the above,
## but without tapping the
#####################
## 2
# explore button
tap 625 485
sleep 6000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
## 3
# explore button
tap 625 485
sleep 6000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
## 4
# explore button
tap 625 485
sleep 6000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
## 5
# explore button
tap 625 485
sleep 6000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
## 6
# explore button
tap 625 485
sleep 6000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
## 7
# explore button
tap 625 485
sleep 6000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
## 8
# explore button
tap 625 485
sleep 6000
# dispatch
tap 1000 600
sleep 5000
# back
tap 100 100
sleep 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment