我正在尝试使用 AndroidViewClient 进行一些自动化。在 [github][1] 上有一个关于“安全模式”的页面。它指出:
AndroidViewClient 有两个可能的后端:
- 视图服务器
- UiAutomator
UiAutomator 适用于 Android API 16 及更高版本,因此如果您的设备有以前的版本,您唯一的选择是 ViewServer。
我正在尝试运行 dump.py,但出现“设备安全”错误。安全模式页面指出“您唯一的选择是 ViewServer”。什么是 viewServer 以及如何将它与 monkeyrunner 一起使用?
我很难理解这一点,因为根据 github 页面上的这张图片,如果我没有 API lvl 16 或更高版本,我可以使用 id 名称(如果我有)(我有)我只是不知道该怎么做。
总之,
我有 API 级别 15 及更低级别的设备和源代码,我想使用 viewID 自动化我的应用程序。那可能吗?
最后一个错误:
C:\Users\EGHDK\android-sdk\tools>monkeyrunner C:\AndroidViewClient-master\Andro
idViewClient-master\AndroidViewClient\examples\dump.py --ignore-secure-device --
do-not-start-view-server
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] Script terminated due to an exception
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]Traceback (most recent call last):
File "C:\AndroidViewClient-master\AndroidViewClient-master\AndroidViewClient\e
xamples\dump.py", line 79, in <module>
ViewClient(*ViewClient.connectToDeviceOrExit(**kwargs1), **kwargs2).traverse
(transform=transform)
File "C:\AndroidViewClient-master\AndroidViewClient-master\AndroidViewClient\s
rc\com\dtmilano\android\viewclient.py", line 991, in __init__
subprocess.check_call([adb, '-s', self.serialno, 'forward', 'tcp:%d' % self.
localPort,
File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 469, in check_call
File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 456, in call
File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 755, in __init__
File "C:\Users\EGHDK\android-sdk\tools\lib\jython.jar\Lib\subprocess.py", lin
e 1269, in _execute_child
OSError: Cannot run program "C:\Windows\system32\adb.exe" (in directory "C:\User
s\EGHDK\android-sdk\tools"): CreateProcess error=2, The system cannot find the
file specified
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyException.doRaise(PyException.java:219)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1159)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1163)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.makeException(Py.java:1167)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py._execute_child$36(C:\Users\EGHDK\android-sdk\tools\lib
\jython.jar\Lib\subprocess.py:1270)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:191)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.__call__(PyFunction.java:385)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyMethod.__call__(PyMethod.java:215)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyMethod.__call__(PyMethod.java:206)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObject.__call__(PyObject.java:367)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObject.__call__(PyObject.java:371)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py.__init__$19(C:\Users\EGHDK\android-sdk\tools\lib\jytho
n.jar\Lib\subprocess.py:844)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:191)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.__call__(PyFunction.java:385)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyMethod.__call__(PyMethod.java:215)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyMethod.__call__(PyMethod.java:206)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObjectDerived.dispatch__init__(PyObjectDerived.java
:1097)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyType.invoke_new_(PyType.java:444)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyType.type___call__(PyType.java:1374)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyType.__call__(PyType.java:1365)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObject._callextra(PyObject.java:537)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py.call$7(C:\Users\EGHDK\android-sdk\tools\lib\jython.jar
\Lib\subprocess.py:456)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.__call__(PyFunction.java:370)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.function___call__(PyFunction.java:375)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.__call__(PyFunction.java:365)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObject._callextra(PyObject.java:537)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py.check_call$8(C:\Users\EGHDK\android-sdk\tools\lib\jyth
on.jar\Lib\subprocess.py:475)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at subprocess$py.call_function(C:\Users\EGHDK\android-sdk\tools\lib\jyt
hon.jar\Lib\subprocess.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:124)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.__call__(PyFunction.java:317)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.__init__$54(C:\AndroidViewClient-m
aster\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewcl
ient.py:995)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient
-master\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\view
client.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyBaseCode.call(PyBaseCode.java:191)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.__call__(PyFunction.java:385)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyFunction.__call__(PyFunction.java:380)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyInstance.__init__(PyInstance.java:120)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyClass.__call__(PyClass.java:194)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyObject._callextra(PyObject.java:537)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.pycode._pyx0.f$0(C:\AndroidViewClient-master\AndroidViewCl
ient-master\AndroidViewClient\examples\dump.py:79)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.pycode._pyx0.call_function(C:\AndroidViewClient-master\And
roidViewClient-master\AndroidViewClient\examples\dump.py)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyTableCode.call(PyTableCode.java:165)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.PyCode.call(PyCode.java:18)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.Py.runCode(Py.java:1197)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.core.__builtin__.execfile_flags(__builtin__.java:538)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:156
)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.
java:77)
130425 14:05:23.047:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter
.java:189)