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

Method swipe

src/com/dtmilano/android/viewclient.py:4165–4183  ·  view source on GitHub ↗
(self, startX=-1, startY=-1, endX=-1, endY=-1, steps=400, segments=None, segmentSteps=5, start=None,
              end=None)

Source from the content-addressed store, hash-verified

4163 self.device.longTouch(x, y)
4164
4165 def swipe(self, startX=-1, startY=-1, endX=-1, endY=-1, steps=400, segments=None, segmentSteps=5, start=None,
4166 end=None):
4167 if startX == -1 and startY == -1 and start:
4168 startX = start[0]
4169 startY = start[1]
4170 if endX == -1 and endY == -1 and end:
4171 endX = end[0]
4172 endY = end[1]
4173 if self.uiAutomatorHelper:
4174 if DEBUG_UI_AUTOMATOR_HELPER:
4175 print("Swipe through UiAutomatorHelper", (startX, startY, endX, endY, steps, segments, segmentSteps),
4176 file=sys.stderr)
4177 if segments:
4178 warnings.warn("Not implemented yet")
4179 return
4180 self.uiAutomatorHelper.ui_device.swipe(start_x=startX, start_y=startY, end_x=endX, end_y=endY, steps=steps)
4181 else:
4182 duration = steps / 2.0
4183 self.device.drag((startX, startY), (endX, endY), duration, steps)
4184
4185 def pressBack(self):
4186 if self.uiAutomatorHelper:

Callers 6

dragMethod · 0.45
longTouchMethod · 0.45
testSwipe_randomMethod · 0.45
test_swipeFunction · 0.45

Calls 1

dragMethod · 0.45

Tested by 4

testSwipe_randomMethod · 0.36
test_swipeFunction · 0.36