MCPcopy
hub / github.com/AirtestProject/Poco / drag_to

Method drag_to

poco/proxy.py:463–487  ·  view source on GitHub ↗

Similar to swipe action, but the end point is provide by a UI proxy or by fixed coordinates. Args: target (:py:class:`UIObjectProxy `): a UI proxy or 2-list/2-tuple coordinates (x, y) in NormalizedCoordinate system dura

(self, target, duration=2.0)

Source from the content-addressed store, hash-verified

461 return ret
462
463 def drag_to(self, target, duration=2.0):
464 """
465 Similar to swipe action, but the end point is provide by a UI proxy or by fixed coordinates.
466
467 Args:
468 target (:py:class:`UIObjectProxy <poco.proxy.UIObjectProxy>`): a UI proxy or 2-list/2-tuple coordinates
469 (x, y) in NormalizedCoordinate system
470 duration (:py:obj:`float`): time interval in which the action is performed
471
472 Raises:
473 PocoNoSuchNodeException: raised when the UI element does not exist
474 """
475
476 try:
477 duration = float(duration)
478 except ValueError:
479 raise ValueError('Argument `duration` should be <float>. Got {}'.format(repr(duration)))
480
481 if type(target) in (list, tuple):
482 target_pos = target
483 else:
484 target_pos = target.get_position()
485 origin_pos = self.get_position()
486 dir_ = [target_pos[0] - origin_pos[0], target_pos[1] - origin_pos[1]]
487 return self.swipe(dir_, duration=duration)
488
489 def scroll(self, direction='vertical', percent=0.6, duration=2.0):
490 """

Callers 4

scrollMethod · 0.80
runTestMethod · 0.80
runTestMethod · 0.80
runTestMethod · 0.80

Calls 2

get_positionMethod · 0.95
swipeMethod · 0.95

Tested by

no test coverage detected