AndroidViewClient无法获取视图的坐标

时间:2013-06-04 16:51:25

标签: android monkeyrunner androidviewclient

我正在使用AndroidViewClient来查找要使用monkeyrunner推送的EditText和Buttons。问题是AndroidViewClient无法获得这些视图的坐标(以像素为单位)。

结果说下一个:

                   com.android.launcher.BubbleTextView id/0x80203 Browser (0, 0)
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:488: UserWarning: View id/0x80002 has no 'layout:mLeft' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.leftProperty))
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:511: UserWarning: View id/0x80002 has no 'layout:mTop' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.topProperty))
               com.android.launcher.BubbleTextView id/0x80002 Messaging (0, 0)
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:488: UserWarning: View id/cell3 has no 'layout:mLeft' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.leftProperty))
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:511: UserWarning: View id/cell3 has no 'layout:mTop' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.topProperty))
            com.android.launcher.CellLayout id/cell3 None (0, 0)
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:488: UserWarning: View id/drawer has no 'layout:mLeft' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.leftProperty))
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:511: UserWarning: View id/drawer has no 'layout:mTop' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.topProperty))
         android.widget.SlidingDrawer id/drawer None (0, 0)
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:488: UserWarning: View id/all_apps has no 'layout:mLeft' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.leftProperty))
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:511: UserWarning: View id/all_apps has no 'layout:mTop' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.topProperty))
            com.android.launcher.HandleView id/all_apps None (0, 0)
            com.android.launcher.AllAppsGridView id/content None (0, 0)
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:488: UserWarning: View id/name has no 'layout:mLeft' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.leftProperty))
/opt/santoku/AndroidViewClient-master/AndroidViewClient/src/com/dtmilano/android/viewclient.py:511: UserWarning: View id/name has no 'layout:mTop' property
  warnings.warn("View %s has no '%s' property" % (self.getId(), self.topProperty))
               android.widget.TextView id/name Alarm Clock (0, 0)
               android.widget.TextView id/name API Demos (0, 0)
               android.widget.TextView id/name Browser (0, 0)
               android.widget.TextView id/name Calculator (0, 0)
               android.widget.TextView id/name Camera (0, 0)
               android.widget.TextView id/name Contacts (0, 0)
               android.widget.TextView id/name Custom Locale (0, 0)
               android.widget.TextView id/name Dev Tools (0, 0)
               android.widget.TextView id/name Email (0, 0)
               android.widget.TextView id/name Gallery (0, 0)
               android.widget.TextView id/name Gestures Builder (0, 0)
               android.widget.TextView id/name Messaging (0, 0)
               android.widget.TextView id/name Music (0, 0)
               android.widget.TextView id/name Phone (0, 0)
               android.widget.TextView id/name Settings (0, 0)
               android.widget.TextView id/name Spare Parts (0, 0)
         com.android.launcher.DeleteZone id/delete_zone None (0, 0)

这个问题有解决办法吗?观点是否有必要明确这些属性?

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

AndroidViewClient并未完全支持

API级别7 ,但事实证明,大多数功能与支持的 API级别8 相同。一个小修复解决了这些问题。

给出最新的AndroidViewclient版本(2.3.20),你应该没问题。