#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')

相关文章:

  • 2021-10-18
  • 2021-10-27
  • 2021-07-06
  • 2021-07-30
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2021-10-29
  • 2021-08-07
  • 2021-06-19
相关资源
相似解决方案