Similar method to :py:meth:`.__getitem__() ` with the difference that this method iterates over all UI elements. The order rules of UI elements is same as for :py:meth:`.__getitem__() `. See ``Iterat
(self)
| 272 | return len(nodes) if nodes else 0 |
| 273 | |
| 274 | def __iter__(self): |
| 275 | """ |
| 276 | Similar method to :py:meth:`.__getitem__() <poco.proxy.UIObjectProxy.__getitem__>` with the difference that this |
| 277 | method iterates over all UI elements. The order rules of UI elements is same as for :py:meth:`.__getitem__() |
| 278 | <poco.proxy.UIObjectProxy.__getitem__>`. See ``IterationOverUI`` for more details. |
| 279 | |
| 280 | Yields: |
| 281 | :py:class:`UIObjectProxy <poco.proxy.UIObjectProxy>`: a generator yielding new UI proxy represents the |
| 282 | specific UI element iterated over |
| 283 | |
| 284 | Raises: |
| 285 | PocoTargetRemovedException: when hierarchy structure has changed and it is attempted to access to the |
| 286 | nonexistent UI element over the iteration |
| 287 | """ |
| 288 | |
| 289 | # 节点数量太多时,就不按照控件顺序排序了 |
| 290 | if not self._query_multiple: |
| 291 | nodes = self._do_query(multiple=True, refresh=True) |
| 292 | else: |
| 293 | nodes = self._nodes |
| 294 | length = len(nodes) |
| 295 | sorted_nodes = [] |
| 296 | for i in range(length): |
| 297 | uiobj = UIObjectProxy(self.poco) |
| 298 | uiobj.query = ('index', (self.query, i)) |
| 299 | uiobj._evaluated = True |
| 300 | uiobj._query_multiple = True |
| 301 | uiobj._nodes = nodes[i] |
| 302 | uiobj._nodes_proxy_is_list = False |
| 303 | pos = uiobj.get_position() |
| 304 | sorted_nodes.append((uiobj, pos)) |
| 305 | sorted_nodes.sort(key=lambda v: (v[1][1], v[1][0])) |
| 306 | |
| 307 | for obj, _ in sorted_nodes: |
| 308 | yield obj |
| 309 | |
| 310 | @wait |
| 311 | def click(self, focus=None, sleep_interval=None): |
nothing calls this directly
no test coverage detected