Perform click (touch, tap, etc.) action on target device at given coordinates. The coordinates (x, y) are either a 2-list or 2-tuple. The coordinates values for x and y must be in the interval between 0 ~ 1 to represent the percentage of the screen. For example, the coordin
(self, pos)
| 226 | return self._agent |
| 227 | |
| 228 | def click(self, pos): |
| 229 | """ |
| 230 | Perform click (touch, tap, etc.) action on target device at given coordinates. |
| 231 | |
| 232 | The coordinates (x, y) are either a 2-list or 2-tuple. The coordinates values for x and y must be in the |
| 233 | interval between 0 ~ 1 to represent the percentage of the screen. For example, the coordinates ``[0.5, 0.5]`` |
| 234 | represent the `center` of the screen and the coordinates ``[0, 0]`` represent the `top left corner`. |
| 235 | |
| 236 | See ``CoordinateSystem`` for more details about coordinate system. |
| 237 | |
| 238 | Examples: |
| 239 | Click the point of ``(100, 100)`` of screen which resolution is ``(1920, 1080)``:: |
| 240 | |
| 241 | poco.click([100.0 / 1920, 100.0 / 1080]) |
| 242 | |
| 243 | Args: |
| 244 | pos (:obj:`list(float, float)` / :obj:`tuple(float, float)`): coordinates (x, y) in range of 0 to 1 |
| 245 | |
| 246 | Raises: |
| 247 | InvalidOperationException: when clicked outside of the screen |
| 248 | """ |
| 249 | |
| 250 | if not (0 <= pos[0] <= 1) or not (0 <= pos[1] <= 1): |
| 251 | raise InvalidOperationException('Click position out of screen. pos={}'.format(repr(pos))) |
| 252 | ret = self.agent.input.click(pos[0], pos[1]) |
| 253 | self.wait_stable() |
| 254 | return ret |
| 255 | |
| 256 | def rclick(self, pos): |
| 257 | raise NotImplementedError |
no test coverage detected