Created
November 9, 2012 04:27
-
-
Save billynyh/4043695 to your computer and use it in GitHub Desktop.
android monkeyrunner screencap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage | |
import datetime | |
def capture_and_save(fname): | |
device = MonkeyRunner.waitForConnection() | |
snapshot = device.takeSnapshot() | |
snapshot.writeToFile(fname) | |
def capture(prefix=""): | |
d = datetime.datetime.now() | |
fname = d.strftime("%Y%m%d-%H%M%S.png") | |
if prefix: | |
fname = prefix + fname | |
capture_and_save(fname) | |
capture() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment