English 中文(简体)
如何从真正的手法手法操作?
原标题:How to run from the real device monkeyrunner script?

我已撰写了该守则,该守则正在起草过程中。 我怎么能以真正的手段开展工作? 是否仅仅将装置连接起来,并改变地点(玻璃点)?

# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage

# Connect to the current device
device = MonkeyRunner.waitForConnection()

# Install package
device.installPackage( C:/android-sdk-windows/tools/lib/purchase.apk )

# Run activity
device.startActivity(component= com.mobilenetwork.purchase/.StartPage  )

# Importing time
import time

# Waiting for 10 secs to be launched on the emulator:
time.sleep(10)
device.press( KEYCODE_BUTTON_SELECT , DOWN ,  )

# Screenshot
time.sleep(10)
result = device.takeSnapshot()

# Writes the screenshot to a file
result.writeToFile( G:\Screenshot\screen_shot.png , png )
问题回答

看起来,它应当致力于一种真正的手段,而这正是现在的。 如果你遇到问题,你可能会试图增加“MonkeyRunner.sleep(n)”的发言(N有)。 一些装置没有等到最后一项任务完成之后才能要求下一个任务。

在你与装置连接之前,你还可以尝试对包件和活动进行配置。





相关问题
screenshots with monkeyrunner on Android

I m using this following script to take screenshots: def snap(): from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice print "Waiting for device.." device = MonkeyRunner....

monkeyrunner and EndCall

I m using MonkeyRunner to play with simulation of user activity. All fine but I cannot press EndCall. To make call I use: device.touch(190, 800, DOWN_AND_UP ) x,y coordinates of CALL button. But ...

How to use MonkeyDevice.instrument?

HI guys, I m trying to run one of my test instrumentation from my MonkeyRunner script. Unfortunately I can t get it to work. I ve tried calling MonkeyDevice.instrument with different variations of ...

How can I reboot Android Emulator using monkeyrunner?

What is wrong with this script? # Imports the monkeyrunner modules used by this program from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice # Connects to the current device, ...

Where is the help.py for Android s monkeyrunner

I just can t find the help.py file in order to create the API reference for the monkeyrunner. The command described at the Android references monkeyrunner <format> help.py <outfile> does ...

热门标签