Skip to content

Instantly share code, notes, and snippets.

@AaronMT
Created February 9, 2012 15:06
Show Gist options
  • Save AaronMT/1780517 to your computer and use it in GitHub Desktop.
Save AaronMT/1780517 to your computer and use it in GitHub Desktop.
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
browsers = ['org.mozilla.fennec/.App']
sites = ["http://google.com",
"http://facebook.com",
"http://youtube.com",
"http://yahoo.com",
"http://baidu.com",
"http://wikipedia.org",
"http://live.com",
"http://blogspot.com",
"http://amazon.com",
"http://twitter.com",
"http://qq.com",
"http://taobao.com",
"http://google.co.in",
"http://msn.com",
"http://yahoo.co.jp",
"http://linkedin.com",
"http://sina.com.cn",
"http://wordpress.com",
"http://google.de",
"http://ebay.com",
"http://google.com.hk",
"http://yandex.ru",
"http://google.co.jp",
"http://google.co.uk",
"http://google.fr",
"http://bing.com",
"http://weibo.com",
"http://t.co",
"http://microsoft.com",
"http://apple.com"]
def main():
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
#Start each browser activity with the provided URI
for run, browser in enumerate(browsers):
# Visit each site
for site in sites:
# Start the activity with the provided site
device.startActivity(component=browser, uri=site)
# Wait for page load timeout
MonkeyRunner.sleep(12)
# Dismiss keyboard on some sites
#device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP)
# Produce a series of drag actions - these x,y vary per device
device.drag((360,1100),(390,150), 0.5, 10)
device.drag((390,150), (360,1100), 0.5, 10)
device.drag((360,1100),(390,150), 0.5, 10)
device.drag((390,150), (360,1100), 0.5, 10)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment