Skip to content

Commit 8966f17

Browse files
committed
2 parents 9c798fa + deb3915 commit 8966f17

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/com/dtmilano/android/viewclient.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,8 +929,16 @@ def touch(self, eventType=adbclient.DOWN_AND_UP, deltaX=0, deltaY=0):
929929
self.device.touch(x+10, y+10, eventType=adbclient.UP)
930930
else:
931931
if self.uiAutomatorHelper:
932-
# FIXME: this could be also clicking the View by OID if findObject() were used to find the Views
933-
self.uiAutomatorHelper.click(x=x, y=y)
932+
try:
933+
oid = self.uiAutomatorHelper.findObject(self.getId())
934+
if DEBUG_UI_AUTOMATOR_HELPER:
935+
print >> sys.stderr, "oid=", oid
936+
print >> sys.stderr, "ignoring click delta to click View as UiObject"
937+
oid.click();
938+
except RuntimeError as e:
939+
print >> sys.stderr, e.message
940+
print >> sys.stderr, "UiObject click failed, using co-ordinates"
941+
self.uiAutomatorHelper.click(x, y)
934942
else:
935943
self.device.touch(x, y, eventType=eventType)
936944

0 commit comments

Comments
 (0)