#Save this file as mms.py and run it by Command: MonkeyRunner mms.py
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# sets a variable with the package's internal name
package = 'com.android.mms'
# sets a variable with the name of an Activity in the package
activity = '.ui.ConversationList'
# sets the name of the component to start
runComponent = package + '/' + activity
# Runs the component
device.startActivity(component=runComponent)
# Presses the Menu button
device.press('KEYCODE_MENU',MonkeyDevice.DOWN_AND_UP)
# Takes a screenshot
result = device.takeSnapshot()
# Writes the screenshot to a file
result.writeToFile('shot1.png','png')
posted @ 2011-09-18 21:25 Justin_Ma 阅读(199) 评论(0)
编辑
写一个help.py
然后用命令 monkeyrunner.bat help.py
即可生成help.html
#help.py
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
text = MonkeyRunner.help("html");
f = open('help.html', 'w')
f.write(text);
f.close();
posted @ 2011-09-18 20:53 Justin_Ma 阅读(83) 评论(0)
编辑