| 911 | |
| 912 | |
| 913 | async def html_from_tree( |
| 914 | tree: Union[cdp.dom.Node, Element], target: Tab |
| 915 | ): |
| 916 | if not hasattr(tree, "children"): |
| 917 | raise TypeError("Object should have a .children attribute!") |
| 918 | out = "" |
| 919 | if tree and tree.children: |
| 920 | for child in tree.children: |
| 921 | if isinstance(child, Element): |
| 922 | out += await child.get_html() |
| 923 | else: |
| 924 | out += await target.send( |
| 925 | cdp.dom.get_outer_html( |
| 926 | backend_node_id=child.backend_node_id |
| 927 | ) |
| 928 | ) |
| 929 | out += await html_from_tree(child, target) |
| 930 | return out |
| 931 | |
| 932 | |
| 933 | def compare_target_info( |