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

Method long_click

poco/proxy.py:407–429  ·  view source on GitHub ↗

Perform the long click action on the UI element(s) represented by the UI proxy. If this UI proxy represents a set of UI elements, the first one in the set is clicked and the anchor point of the UI element is used as the default one. Similar to click but press the screen fo

(self, duration=2.0)

Source from the content-addressed store, hash-verified

405
406 @wait
407 def long_click(self, duration=2.0):
408 """
409 Perform the long click action on the UI element(s) represented by the UI proxy. If this UI proxy represents a
410 set of UI elements, the first one in the set is clicked and the anchor point of the UI element is used as the
411 default one. Similar to click but press the screen for the given time interval and then release.
412
413 Args:
414 duration (:py:obj:`float`): whole action duration.
415
416 Return:
417 the same as :py:meth:`poco.pocofw.Poco.long_click`, depending on poco agent implementation.
418 """
419
420 try:
421 duration = float(duration)
422 except ValueError:
423 raise ValueError('Argument `duration` should be <float>. Got {}'.format(repr(duration)))
424
425 pos_in_percentage = self.get_position(self._focus or 'center')
426 self.poco.pre_action('long_click', self, pos_in_percentage)
427 ret = self.poco.long_click(pos_in_percentage, duration)
428 self.poco.post_action('long_click', self, pos_in_percentage)
429 return ret
430
431 @wait
432 def swipe(self, direction, focus=None, duration=0.5):

Callers

nothing calls this directly

Calls 3

get_positionMethod · 0.95
pre_actionMethod · 0.80
post_actionMethod · 0.80

Tested by

no test coverage detected