Info: Initial study, inevitably there will be omissions, in the future I will continue to revise the completion, until perfect. Reprint Please indicate the source, thank you.
2014-10-11: First Edition
--------------------------------------------
After the Monkeyrunner environment is configured, start the emulator and write a simplest script.
" "Created on Oct one, 2014@author:deldong" "Print 'before execution'#Imports the Monkeyrunner modules used by this program fromCom.android.monkeyrunnerImportMonkeyrunner#connects to the current device, returning a Monkeydevice objectdevice =monkeyrunner.waitforconnection ()Print 'After execution'
Didn't ever want to throw a big importerror:
from com.android.monkeyrunner import monkeyrunner, monkeydevice, Monkeyimage
Importerror: No module named Com.android.monkeyrunner
What to do, whether the project did not introduce the corresponding class library, then introduce it.
After introduction, execute again, or importerror: No module named Com.android.monkeyrunner.
What to do, Google a bit, unexpectedly someone said windows can not use Eclipse to execute Monkeyrunner script, this undoubtedly poured a basin of cold water AH ~ ~
There is no way to have their own efforts, Emperor not bear it ~ ~ Suddenly think of Monkeyrunner script in execution, is monkeyrunner+ script execution way, is not I add monkeyrunner.bat to the Python interpreter is good, say try to try.
1. Open Windows->preferences->python Interpreter,
2. Select New,interpreter name, interpreter executable find the Monkeyrunner.bat file, and then select OK.
3. In this case, point proceed anyways
4. Then select OK, and you're ready.
Next, witness the moment of miracles:
Congratulations, the implementation passed, and so far finally successfully executed the Monkeyrunner script in Eclipse.
Android Automation: Executing Monkeyrunner scripts with eclipse