Returns the element's children. Those children also have a children property so that you can browse through the entire tree as well.
(self)
| 322 | |
| 323 | @property |
| 324 | def children(self) -> typing.Union[typing.List[Element], str]: |
| 325 | """ |
| 326 | Returns the element's children. |
| 327 | Those children also have a children property |
| 328 | so that you can browse through the entire tree as well. |
| 329 | """ |
| 330 | _children = [] |
| 331 | if self._node.node_name == "IFRAME": |
| 332 | # iframes are not the same as other nodes. |
| 333 | # The children of iframes are found under |
| 334 | # the .content_document property, |
| 335 | # which is more useful than the node itself. |
| 336 | frame = self._node.content_document |
| 337 | if not frame.child_node_count: |
| 338 | return [] |
| 339 | for child in frame.children: |
| 340 | child_elem = create(child, self._tab, frame) |
| 341 | if child_elem: |
| 342 | _children.append(child_elem) |
| 343 | # self._node = frame |
| 344 | return _children |
| 345 | elif not self.node.child_node_count: |
| 346 | return [] |
| 347 | if self.node.children: |
| 348 | for child in self.node.children: |
| 349 | child_elem = create(child, self._tab, self.tree) |
| 350 | if child_elem: |
| 351 | _children.append(child_elem) |
| 352 | return _children |
| 353 | |
| 354 | @property |
| 355 | def remote_object(self) -> cdp.runtime.RemoteObject: |