Beispiel #1
0
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()

# Get the current path
path = sys.path[0]
path = path.replace('\\', '/')
path = path[path.rfind(":") - 1:]

# Runs the component
device.startActivity(
    component=
    "cn.richinfo.thinkdrive/cn.richinfo.thinkdrive.ui.activities.NavigateActivity"
)
# Sleep 5's
MonkeyRunner.Sleep(5)

# Takes a screenshot
result = device.takeSnapshot()
# Writes the screenshot to a file
filepath = path + "/Test3_001.png"
result.writeToFile(filepath, 'png')

# First Left Drag
device.drag((580, 1053), (100, 1053), 0.1, 10)
# Sleep 1's
MonkeyRunner.Sleep(1)

# Takes a screenshot
result = device.takeSnapshot()
# Writes the screenshot to a file