Return the number of selected UI elements. Returns: :obj:`int`: returns 0 if none of the UI element matches the query expression otherwise returns the number of selected UI elements
(self)
| 250 | return self._sorted_children[item][0] |
| 251 | |
| 252 | def __len__(self): |
| 253 | """ |
| 254 | Return the number of selected UI elements. |
| 255 | |
| 256 | Returns: |
| 257 | :obj:`int`: returns 0 if none of the UI element matches the query expression otherwise returns the number |
| 258 | of selected UI elements |
| 259 | """ |
| 260 | |
| 261 | if not self._nodes_proxy_is_list: |
| 262 | return 1 |
| 263 | |
| 264 | # 获取长度时总是multiple的 |
| 265 | if not self._query_multiple: |
| 266 | try: |
| 267 | nodes = self._do_query(multiple=True, refresh=True) |
| 268 | except PocoNoSuchNodeException: |
| 269 | nodes = [] |
| 270 | else: |
| 271 | nodes = self._nodes |
| 272 | return len(nodes) if nodes else 0 |
| 273 | |
| 274 | def __iter__(self): |
| 275 | """ |