Question

I am get the all the Id's of the current screen without using the Source.

https://stackoverflow.com/questions/23333936/android-get-id-of-the-each-widget-in-the-screen-without-source

So I am using Androidviewclient

Have followed below steps

1) Downloaded the Androidviewclient-master.zip

2) unzipped and edited the dump file in the AndroidViewClient-master\AndroidViewClient\tools for the souce location

3) Set the Environment variable ANDROID_VIEW_CLIENT_HOME and PYTHONPATH

4) When i execute as below in cmd

C:\Users\Lahir\Desktop\Automation\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\tools>monkeyrunner.bat C:\AndroidViewClient-master\AndroidViewClient\tools\dump.py

Getting Error as below:-

Can't open specified script file Usage: monkeyrunner [options] SCRIPT_FILE -s MonkeyServer IP Address. -p MonkeyServer TCP Port. -v MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)

And also instead of dump.py if i run as dump as below

C:\Users\Lahir\Desktop\Automation\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\tools>monkeyrunner.bat C:\AndroidViewClient-master\AndroidViewClient\tools\dump

I am getting the following Error

140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last): File "C:\AndroidViewClient-master\AndroidViewClient\tools\dump", line 129, in vc = ViewClient(*ViewClient.connectToDeviceOrExit(**kwargs1), **kwargs2) File "C:\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 1435, in connectToDeviceOrExit ViewClient.setAlarm(timeout+5) File "C:\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewclient.py", line 1395, in setAlarm signal.alarm(timeout) File "C:\Users\Lahir\Desktop\Automation\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\tools\lib\jython-standalone-2.5.3.jar\Lib\signal.py", line 222, in alarm

NotImplementedError: alarm not implemented on this platform

140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyException.doRaise(PyException.java:219) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.makeException(Py.java:1239) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.makeException(Py.java:1243) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.makeException(Py.java:1247) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at signal$py.alarm$14(C:\Users\Lahir\Desktop\Automation\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\tools\lib\jython-standalone-2.5.3.jar\Lib\s 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at signal$py.call_function(C:\Users\Lahir\Desktop\Automation\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\tools\lib\jython-standalone-2.5.3.jar\ 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyBaseCode.call(PyBaseCode.java:134) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyFunction.call(PyFunction.java:317) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.dtmilano.android.viewclient$py.setAlarm$71(C:\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewclient.py:1395) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewclient.py) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyBaseCode.call(PyBaseCode.java:134) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyFunction.call(PyFunction.java:317) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.dtmilano.android.viewclient$py.connectToDeviceOrExit$72(C:\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewclient.py:1463) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.dtmilano.android.viewclient$py.call_function(C:\AndroidViewClient-master\AndroidViewClient\src\com\dtmilano\android\viewclient.py) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyBaseCode.call(PyBaseCode.java:301) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyFunction.function___call__(PyFunction.java:376) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyFunction.call(PyFunction.java:371) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyFunction.call(PyFunction.java:366) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyObject._callextra(PyObject.java:527) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.f$0(C:\AndroidViewClient-master\AndroidViewClient\tools\dump:131) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.call_function(C:\AndroidViewClient-master\AndroidViewClient\tools\dump) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyCode.call(PyCode.java:18) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.runCode(Py.java:1275) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.builtin.execfile_flags(builtin.java:522) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77) 140509 17:19:12.884:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)

Don't know how to get it? Need help please guide me.

Was it helpful?

Solution

I'm assuming you downloaded the latest version from github (.i.e. AndroidViewClient 5.4.7). In such case, you don't need monkeyrunner, just python.

I think

python C:\AndroidViewClient-master\AndroidViewClient\tools\dump.py

should work (sorry, I'm guessing as I don't use Windows).

You could also give easy_install a try and keep AndroidViewClient up-to-date automatically. Check How to use Python's "easy_install" on Windows ... it's not so easy for some hints.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top