Google Product Forums

MonkeyRunner unable to get Views on Nexus


Mallik141 Aug 1, 2012 7:13 AM
Posted in group: Google Mobile Help Forum

Categories: Android Devices : Other Google Products :

hi,
 
I am trying to write a MonkeyRunner script to touch on the screen based on the location of Views/widgets.  No Matter what i try to do with views it throws me an exception as below
 
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_05
>>> from com.android.monkeyrunner import MonkeyDevice,MonkeyRunner
>>> device = MonkeyRunner.waitForConnection()
>>> device.getRootView()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
        at com.android.chimpchat.ChimpManager.getRootView(ChimpManager.java:430)
        at com.android.chimpchat.adb.AdbChimpDevice.getRootView(AdbChimpDevice.j
ava:605)
        at com.android.monkeyrunner.MonkeyDevice.getRootView(MonkeyDevice.java:4
11)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
com.android.chimpchat.core.ChimpException: com.android.chimpchat.core.ChimpExcep
tion: No accessibility event has occured yet
>>>
Also is there a work around where i can directly access a wdiget instead of going through views. I would like to be able to check if widget for ex. Phone icon exists on homescreen and just touch it.
 
-Mallik