MCPcopy Index your code
hub / github.com/AirtestProject/Poco / scroll

Method scroll

poco/proxy.py:489–518  ·  view source on GitHub ↗

Simply touch down from point A and move to point B then release up finally. This action is performed within specific motion range and duration. Args: direction (:py:obj:`str`): scrolling direction. "vertical" or "horizontal" percent (:py:obj:`float`)

(self, direction='vertical', percent=0.6, duration=2.0)

Source from the content-addressed store, hash-verified

487 return self.swipe(dir_, duration=duration)
488
489 def scroll(self, direction='vertical', percent=0.6, duration=2.0):
490 """
491 Simply touch down from point A and move to point B then release up finally. This action is performed within
492 specific motion range and duration.
493
494 Args:
495 direction (:py:obj:`str`): scrolling direction. "vertical" or "horizontal"
496 percent (:py:obj:`float`): scrolling distance percentage of selected UI height or width according to
497 direction
498 duration (:py:obj:`float`): time interval in which the action is performed
499
500 Raises:
501 PocoNoSuchNodeException: raised when the UI element does not exist
502 """
503
504 if direction not in ('vertical', 'horizontal'):
505 raise ValueError('Argument `direction` should be one of "vertical" or "horizontal". Got {}'
506 .format(repr(direction)))
507
508 focus1 = self._focus or [0.5, 0.5]
509 focus2 = list(focus1)
510 half_distance = percent / 2
511 if direction == 'vertical':
512 focus1[1] += half_distance
513 focus2[1] -= half_distance
514 else:
515 focus1[0] += half_distance
516 focus2[0] -= half_distance
517
518 return self.focus(focus1).drag_to(self.focus(focus2), duration=duration)
519
520 def pinch(self, direction='in', percent=0.6, duration=2.0, dead_zone=0.1):
521 """

Callers

nothing calls this directly

Calls 2

focusMethod · 0.95
drag_toMethod · 0.80

Tested by

no test coverage detected