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

Method click

poco/proxy.py:311–340  ·  view source on GitHub ↗

Perform the 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. It is also possible to click another point offs

(self, focus=None, sleep_interval=None)

Source from the content-addressed store, hash-verified

309
310 @wait
311 def click(self, focus=None, sleep_interval=None):
312 """
313 Perform the click action on the UI element(s) represented by the UI proxy. If this UI proxy represents a set of
314 UI elements, the first one in the set is clicked and the anchor point of the UI element is used as the default
315 one. It is also possible to click another point offset by providing ``focus`` argument.
316
317 See ``CoordinateSystem`` for more details.
318
319 Args:
320 focus (2-:obj:`tuple`/2-:obj:`list`/:obj:`str`): an offset point (x, y) from the top left corner of the UI
321 element(s), values must be in range of 0~1. This argument can be also specified by 'anchor' or 'center'.
322 'Center' means to click the center of bounding box of UI element.
323 sleep_interval: number of seconds to wait after this action. Default is None which is the default sleep
324 interval. This value can be configured by Poco initialization. See configuration at poco
325 :py:class:`initialization <poco.pocofw.Poco>` for more details.
326
327 Raises:
328 PocoNoSuchNodeException: raised when the UI element does not exist
329 """
330
331 focus = focus or self._focus or 'center'
332 pos_in_percentage = self.get_position(focus)
333 self.poco.pre_action('click', self, pos_in_percentage)
334 ret = self.poco.click(pos_in_percentage)
335 if sleep_interval:
336 time.sleep(sleep_interval)
337 else:
338 self.poco.wait_stable()
339 self.poco.post_action('click', self, pos_in_percentage)
340 return ret
341
342 @wait
343 def rclick(self, focus=None, sleep_interval=None):

Callers

nothing calls this directly

Calls 4

get_positionMethod · 0.95
pre_actionMethod · 0.80
wait_stableMethod · 0.80
post_actionMethod · 0.80

Tested by

no test coverage detected