如何在shell(终端)中执行monkeyrunner命令
当我从 shell 开始我的脚本时,我会做这样的事情
monkeyrunner myScriptFile
,然后
在 myScriptFile 中我有这样的内容
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection()
device.installPackage('myproject/bin/MyApplication.apk')
.....
,一切正常,但我想做一些更奇特的事情:),我想从终端(shell)编写所有内容,
所以是否可以在 shell 中编写所有内容?我的意思是,在 myScriptFile 中编写的命令是否可以直接在 shell 中执行,而不需要像 myScriptFile 这样的附加文件
,或者换句话说,是否可以在 shell 中执行“from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice”命令?
When I start my scrip from the shell I do something like this
monkeyrunner myScriptFile
and then
in myScriptFile I have content like this
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection()
device.installPackage('myproject/bin/MyApplication.apk')
.....
and everything works fine, but I want to do something more fancy :), I want to write everything from the terminal(shell)
so is it possible to write everything in shell ? I mean is it possible the commands that are written in myScriptFile to be executed directly in shell without additional file like myScriptFile
or with other words is it possible to execute the 'from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice' command in shell ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要安装软件包,您可以使用
adb
而不是monkeyrunner
:adb install -r 'myproject/bin/MyApplication.apk'
如果您编写 shell 脚本,您可以在此处使用 shell 字符串语法以避免与 Monkeyrunner 脚本分开的文件:
To install package you can use
adb
instead ofmonkeyrunner
:adb install -r 'myproject/bin/MyApplication.apk'
if you write shell script, you can use shell here string syntax to avoid separate file with monkeyrunner script: