[英]How can I pause Monkeyrunner for user input?
如果我在monkeyrunner 中運行並希望用戶能夠在我的程序運行時將某些內容輸入到我的python 腳本中,我該怎么做?
目前input()
從不注冊我按回車鍵。
我不知道這是為什么。 我昨天和今天都搜索了,沒有找到答案。
我通過鍵入來運行我的代碼: monkeyrunner.bat absolutePathnameToPythonFile
我從 Windows 10 上的命令行運行代碼。
Monkeyrunner 使用的是 python 版本 2.5.3
這是我的代碼:
# -*- coding: utf-8 -*-
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
import sys
print("using python version: " + str(sys.version_info))
print("Enter anything to end program...")
character = input()
print(str(character)) #Never Gets here.
print("-Program Ended-")
您可以嘗試使用AndroidViewClient/culebra , monkeyrunner
在 99% 的情況下是monkeyrunner
替代品,並且因為它是 Python,所以您不必處理那些 jython 問題。
我知道它晚了,但它會幫助其他猴子跑步者raw_input()
input()
都掛在我身上,我最終制作了一個 http 服務器來與猴子交談,如該線程中所述:
Android Monkey Runner 設備調用掛起但在進程被終止時工作
我試過: AndroidViewClient/culebra
但它太慢了
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.