3
我有一個正在試圖獲得對一個視圖的一些信息,像這樣一個monkeyrunner腳本:monkeyrunner - 嘗試使用view.getLocation時ChimpException()
v = d.getViewById('id/search_progress_bar')
print dir(v)
for i in range(10):
print 'about to call v.getLocation'
print v.getLocation()
m.sleep(1)
這裏的輸出DIR步驟(v):
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'getAccessibilityIds', 'getChecked', 'getChildren', 'getEnabled', 'getFocused', 'getLocation', 'getParent', 'getSelected', 'getText', 'getViewClass', 'setFocused', 'setSelected']
然而,當我嘗試使用v.getLocation()方法,我得到下面馬上例外。
121024 16:30:26.373:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
121024 16:30:26.373:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
File "/Users/swolfe/svn/jython/progress_bar_testing.py", line 20, in <module>
print v.getLocation()
at com.android.chimpchat.ChimpManager.queryView(ChimpManager.java:414)
at com.android.chimpchat.core.ChimpView.queryView(ChimpView.java:52)
at com.android.chimpchat.core.ChimpView.getLocation(ChimpView.java:64)
at com.android.monkeyrunner.MonkeyView.getLocation(MonkeyView.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
com.android.chimpchat.core.ChimpException: com.android.chimpchat.core.ChimpException: No accessibility event has occured yet
是否有人熟悉ChimpChat?我認爲這是MonkeyRunner的一些核心代碼。可訪問性和MonkeyRunner之間的關係是什麼?它爲什麼抱怨可訪問性事件還沒有發生?我是否需要啓動某種輔助功能或儀器服務?
謝謝。
謝謝dtmilano,我是你的博客的粉絲。當我看到monkeydevice可用的方法時,我想也許AndroidViewClient已被合併到MR中。我一定會看看AVC,謝謝! –