MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / touch

Method touch

src/com/dtmilano/android/viewclient.py:4132–4147  ·  view source on GitHub ↗
(self, x=-1, y=-1, selector=None)

Source from the content-addressed store, hash-verified

4130 self.touch(x=x, y=y, selector=selector)
4131
4132 def touch(self, x=-1, y=-1, selector=None):
4133 if self.uiAutomatorHelper:
4134 if selector:
4135 if DEBUG_UI_AUTOMATOR_HELPER:
4136 print("Touching View by selector=%s through UiAutomatorHelper" % selector, file=sys.stderr)
4137 # FIXME: is `selector` a `bySlector`?
4138 object_ref = self.uiAutomatorHelper.ui_device.find_object(by_selector=selector)
4139 if DEBUG_UI_AUTOMATOR_HELPER:
4140 print("♦️ object_ref=%s" % object_ref, file=sys.stderr)
4141 self.uiAutomatorHelper.ui_object2.click(oid=object_ref.oid)
4142 else:
4143 if DEBUG_UI_AUTOMATOR_HELPER:
4144 print("Touching (%d, %d) through UiAutomatorHelper" % (x, y), file=sys.stderr)
4145 self.uiAutomatorHelper.ui_device.click(x=int(x), y=int(y))
4146 else:
4147 self.device.touch(x, y)
4148
4149 def longTouch(self, x=-1, y=-1, selector=None):
4150 if self.uiAutomatorHelper:

Callers 1

clickMethod · 0.95

Calls 3

find_objectMethod · 0.45
clickMethod · 0.45
touchMethod · 0.45

Tested by

no test coverage detected